Trait edm_core::extension::HeaderMapExt
source · pub trait HeaderMapExt {
// Required method
fn get_str(&self, key: &str) -> Option<&str>;
// Provided methods
fn get_host(&self) -> Option<&str> { ... }
fn get_client_ip(&self) -> Option<IpAddr> { ... }
fn get_content_type(&self) -> Option<&str> { ... }
fn has_json_content_type(&self) -> bool { ... }
}Expand description
Extension trait for HeaderMap.
Required Methods§
Provided Methods§
sourcefn get_host(&self) -> Option<&str>
fn get_host(&self) -> Option<&str>
Gets the destination host.
It is determined in the following priority:
Forwardedheaderhostkey- The first
X-Forwarded-Hostheader Hostheader
sourcefn get_client_ip(&self) -> Option<IpAddr>
fn get_client_ip(&self) -> Option<IpAddr>
Gets the client’s remote IP.
It is determined in the following priority:
Forwardedheaderforkey- The first
X-Forwarded-Forheader - The first
X-Real-Ipheader
sourcefn get_content_type(&self) -> Option<&str>
fn get_content_type(&self) -> Option<&str>
Gets the essence of the content-type header, discarding the optional parameters.
sourcefn has_json_content_type(&self) -> bool
fn has_json_content_type(&self) -> bool
Checks whether it has a content-type: application/json or similar header.