pub struct Headers(pub Headers);
Expand description
A Headers representation used in Request and Response objects.
Tuple Fields§
§0: Headers
Implementations§
source§impl Headers
impl Headers
sourcepub fn get(&self, name: &str) -> Result<Option<String>>
pub fn get(&self, name: &str) -> Result<Option<String>>
Returns all the values of a header within a Headers
object with a given name.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn has(&self, name: &str) -> Result<bool>
pub fn has(&self, name: &str) -> Result<bool>
Returns a boolean stating whether a Headers
object contains a certain header.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn append(&mut self, name: &str, value: &str) -> Result<()>
pub fn append(&mut self, name: &str, value: &str) -> Result<()>
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn set(&mut self, name: &str, value: &str) -> Result<()>
pub fn set(&mut self, name: &str, value: &str) -> Result<()>
Sets a new value for an existing header inside a Headers
object, or adds the header if it does not already exist.
Returns an error if the name is invalid (e.g. contains spaces)
sourcepub fn delete(&mut self, name: &str) -> Result<()>
pub fn delete(&mut self, name: &str) -> Result<()>
Deletes a header from a Headers
object.
Returns an error if the name is invalid (e.g. contains spaces)
or if the JS Headers object’s guard is immutable (e.g. for an incoming request)
sourcepub fn entries(
&self
) -> Map<Map<IntoIter, fn(_: Result<JsValue, JsValue>) -> Array>, fn(_: Array) -> (String, String)> ⓘ
pub fn entries( &self ) -> Map<Map<IntoIter, fn(_: Result<JsValue, JsValue>) -> Array>, fn(_: Array) -> (String, String)> ⓘ
Returns an iterator allowing to go through all key/value pairs contained in this object.