Function httptest::matchers::contains[][src]

pub fn contains<M>(inner: M) -> Contains<M>
Expand description

true if any input element matches the provided mapper.

This works on slices of elements. Each element is handed to the provided mapper until the mapper returns true for one, false if no elements evaluate to true.

Look at matches() if substring matching is what want.

Example

use httptest::matchers::*;

// A request matcher that matches a request with a header `x-foobar=value`.
request::headers(contains(("x-foobar", "value")));

// A request matcher that matches a request with a query parameter `foo=bar`.
request::query(url_decoded(contains(("foo", "bar"))));

// A request matcher that matches a request with a query parameter `foo` and any value.
// Same as `contains(key("foo"))`.
request::query(url_decoded(contains(("foo", any()))));