Expand description

Reply Filters

These “filters” behave a little differently than the rest. Instead of being used directly on requests, these filters “wrap” other filters.

Wrapping a Filter (with)

use warp::Filter;

let with_server = warp::reply::with::header("server", "warp");

let route = warp::any()
    .map(warp::reply)
    .with(with_server);

Wrapping allows adding in conditional logic before the request enters the inner filter (though the with::header wrapper does not).

Structs

Wrap a Filter to set a header if it is not already set.

Wrap a Filter to always set a header.

Wrap a Filter to always set multiple headers.

Functions

Wrap a Filter that adds a header to the reply, if they aren’t already set.

Wrap a Filter that adds a header to the reply.

Wrap a Filter that adds multiple headers to the reply.