Struct http_cache_reqwest::HttpResponse
source · pub struct HttpResponse {
pub body: Vec<u8>,
pub headers: HashMap<String, String>,
pub status: u16,
pub url: Url,
pub version: HttpVersion,
}
Expand description
A basic generic type that represents an HTTP response
Fields§
§body: Vec<u8>
HTTP response body
headers: HashMap<String, String>
HTTP response headers
status: u16
HTTP response status code
url: Url
HTTP response url
version: HttpVersion
HTTP response version
Implementations§
source§impl HttpResponse
impl HttpResponse
sourcepub fn parts(&self) -> Result<Parts, Box<dyn Error + Send + Sync>>
pub fn parts(&self) -> Result<Parts, Box<dyn Error + Send + Sync>>
Returns http::response::Parts
sourcepub fn warning_code(&self) -> Option<usize>
pub fn warning_code(&self) -> Option<usize>
Returns the status code of the warning header if present
sourcepub fn add_warning(&mut self, url: &Url, code: usize, message: &str)
pub fn add_warning(&mut self, url: &Url, code: usize, message: &str)
Adds a warning header to a response
sourcepub fn remove_warning(&mut self)
pub fn remove_warning(&mut self)
Removes a warning header from a response
sourcepub fn update_headers(
&mut self,
parts: &Parts
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn update_headers( &mut self, parts: &Parts ) -> Result<(), Box<dyn Error + Send + Sync>>
Update the headers from http::response::Parts
sourcepub fn must_revalidate(&self) -> bool
pub fn must_revalidate(&self) -> bool
Checks if the Cache-Control header contains the must-revalidate directive
sourcepub fn cache_status(&mut self, hit_or_miss: HitOrMiss)
pub fn cache_status(&mut self, hit_or_miss: HitOrMiss)
Adds the custom x-cache
header to the response
sourcepub fn cache_lookup_status(&mut self, hit_or_miss: HitOrMiss)
pub fn cache_lookup_status(&mut self, hit_or_miss: HitOrMiss)
Adds the custom x-cache-lookup
header to the response
Trait Implementations§
source§impl Clone for HttpResponse
impl Clone for HttpResponse
source§fn clone(&self) -> HttpResponse
fn clone(&self) -> HttpResponse
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for HttpResponse
impl Debug for HttpResponse
source§impl<'de> Deserialize<'de> for HttpResponse
impl<'de> Deserialize<'de> for HttpResponse
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<HttpResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<HttpResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Serialize for HttpResponse
impl Serialize for HttpResponse
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for HttpResponse
impl Send for HttpResponse
impl Sync for HttpResponse
impl Unpin for HttpResponse
impl UnwindSafe for HttpResponse
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more