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(&self, name: &str, value: &str) -> Result<()>
pub fn append(&self, name: &str, value: &str) -> Result<()>
Returns an error if the name is invalid (e.g. contains spaces)
Sourcepub fn set(&self, name: &str, value: &str) -> Result<()>
pub fn set(&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(&self, name: &str) -> Result<()>
pub fn delete(&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.
Sourcepub fn keys(&self) -> impl Iterator<Item = String>
pub fn keys(&self) -> impl Iterator<Item = String>
Returns an iterator allowing you to go through all keys of the key/value pairs contained in this object.