warp::filters::header

Function exact

source
pub fn exact(
    name: &'static str,
    value: &'static str,
) -> impl Filter<Extract = (), Error = Rejection> + Copy
Expand description

Create a Filter that requires a header to match the value exactly.

This Filter will look for a header with supplied name and the exact value, otherwise rejects the request.

ยงExample

// Require `dnt: 1` header to be set.
let must_dnt = warp::header::exact("dnt", "1");