Function warp::filters::reply::header

source ·
pub fn header<K, V>(name: K, value: V) -> WithHeader
Expand description

Wrap a Filter that adds a header to the reply.

§Note

This only adds a header if the underlying filter is successful, and returns a Reply If the underlying filter was rejected, the header is not added.

§Example

use warp::Filter;

// Always set `foo: bar` header.
let route = warp::any()
    .map(warp::reply)
    .with(warp::reply::with::header("foo", "bar"));