Struct http_cache_reqwest::HttpResponse
source · pub struct HttpResponse {
pub body: Vec<u8, Global>,
pub headers: HashMap<String, String, RandomState>,
pub status: u16,
pub url: Url,
pub version: HttpVersion,
}Expand description
A basic generic type that represents an HTTP response
Fields§
§body: Vec<u8, Global>HTTP response body
headers: HashMap<String, String, RandomState>HTTP response headers
status: u16HTTP response status code
url: UrlHTTP response url
version: HttpVersionHTTP response version
Implementations§
source§impl HttpResponse
impl HttpResponse
sourcepub fn parts(&self) -> Result<Parts, CacheError>
pub fn parts(&self) -> Result<Parts, CacheError>
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<(), CacheError>
pub fn update_headers(&mut self, parts: &Parts) -> Result<(), CacheError>
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