[−][src]Function finchers::endpoints::header::matches
pub fn matches<K, V>(name: K, value: V) -> Matches<V> where
HeaderName: HttpTryFrom<K>,
<HeaderName as HttpTryFrom<K>>::Error: Debug,
V: PartialEq<HeaderValue>,
Create an endpoint which checks if a header entry with the specified name is equal to the specified value.
If the header with the given name does not exists or it is not equal to the specified value, it treats the request as not matching.
Examples
let endpoint = header::matches("origin", "www.example.com");
ⓘThis example is not tested
use finchers::error; let endpoint = header::matches("origin", "www.example.com") .wrap(endpoint::wrapper::or_reject_with(|_, _| error::bad_request("invalid header value")));