Skip to main content

HeaderMapExt

Trait HeaderMapExt 

Source
pub trait HeaderMapExt {
Show 21 methods // Required methods fn content_type(&self) -> Option<ContentType>; fn content_length(&self) -> Option<u64>; fn authorization(&self) -> Option<&str>; fn accept(&self) -> Option<&str>; fn host(&self) -> Option<&str>; fn user_agent(&self) -> Option<&str>; fn cache_control(&self) -> Option<&str>; fn etag(&self) -> Option<&str>; fn if_none_match(&self) -> Option<&str>; fn if_modified_since(&self) -> Option<&str>; fn cookie_header(&self) -> Option<&str>; fn location(&self) -> Option<&str>; fn referer(&self) -> Option<&str>; fn set_content_type(&mut self, ct: &ContentType) -> Result<(), OxiHttpError>; fn set_content_length(&mut self, len: u64) -> Result<(), OxiHttpError>; fn set_bearer_auth(&mut self, token: &str) -> Result<(), OxiHttpError>; fn set_basic_auth( &mut self, username: &str, password: Option<&str>, ) -> Result<(), OxiHttpError>; fn set_cache_control(&mut self, value: &str) -> Result<(), OxiHttpError>; fn set_etag(&mut self, value: &str) -> Result<(), OxiHttpError>; fn set_location(&mut self, value: &str) -> Result<(), OxiHttpError>; fn set_cookie_header(&mut self, value: &str) -> Result<(), OxiHttpError>;
}
Expand description

Extension trait providing typed accessors for common HTTP headers.

Required Methods§

Source

fn content_type(&self) -> Option<ContentType>

Get the Content-Type header as a parsed ContentType.

Source

fn content_length(&self) -> Option<u64>

Get the Content-Length header as a u64.

Source

fn authorization(&self) -> Option<&str>

Get the Authorization header value.

Source

fn accept(&self) -> Option<&str>

Get the Accept header value.

Source

fn host(&self) -> Option<&str>

Get the Host header value.

Source

fn user_agent(&self) -> Option<&str>

Get the User-Agent header value.

Source

fn cache_control(&self) -> Option<&str>

Get the Cache-Control header value.

Source

fn etag(&self) -> Option<&str>

Get the ETag header value.

Source

fn if_none_match(&self) -> Option<&str>

Get the If-None-Match header value.

Source

fn if_modified_since(&self) -> Option<&str>

Get the If-Modified-Since header value.

Source

fn cookie_header(&self) -> Option<&str>

Get the raw Cookie header value (not parsed).

Source

fn location(&self) -> Option<&str>

Get the Location header value.

Source

fn referer(&self) -> Option<&str>

Get the Referer header value.

Source

fn set_content_type(&mut self, ct: &ContentType) -> Result<(), OxiHttpError>

Set a typed Content-Type header.

Source

fn set_content_length(&mut self, len: u64) -> Result<(), OxiHttpError>

Set a Content-Length header.

Source

fn set_bearer_auth(&mut self, token: &str) -> Result<(), OxiHttpError>

Set a Bearer authorization header.

Source

fn set_basic_auth( &mut self, username: &str, password: Option<&str>, ) -> Result<(), OxiHttpError>

Set a Basic authorization header from username and password.

Source

fn set_cache_control(&mut self, value: &str) -> Result<(), OxiHttpError>

Set the Cache-Control header.

Source

fn set_etag(&mut self, value: &str) -> Result<(), OxiHttpError>

Set the ETag header.

Source

fn set_location(&mut self, value: &str) -> Result<(), OxiHttpError>

Set the Location header.

Append a Set-Cookie header value (uses append per RFC 6265).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§