Expand description
A collection of different matching strategies provided out-of-the-box by wiremock
.
If the set of matchers provided out-of-the-box is not enough for your specific testing needs
you can implement your own thanks to the Match
trait.
Furthermore, Fn
closures that take an immutable Request
reference as input and return a boolean
as input automatically implement Match
and can be used where a matcher is expected.
Check Match
’s documentation for examples.
Structs§
- Match all incoming requests, regardless of their method, path, headers or body.
- Match an incoming request if it contains the basic authentication header with the username and password as per RFC 7617.
- Match an incoming request if it contains the bearer token header as per RFC 6750.
- Match part of the body of a request.
- Match exactly the body of a request.
- Match part JSON body of a request.
- Match exactly the header of a request.
- Match exactly the header name of a request. It checks that the header is present but does not validate the value.
- Match the value of a header using a regular expression. If the header is multi-valued, all values must satisfy the regular expression. If the header is missing, the mock will not match.
- Match exactly the method of a request.
- Match exactly the path of a request.
- Match the path of a request against a regular expression.
- Match when a query parameter contains the specified value as a substring.
- Match exactly the query parameter of a request.
- Only match requests that do not contain a specified query parameter.
Functions§
- Shorthand for
AnyMatcher
. - Shorthand for
BasicAuthMatcher::from_credentials
. - Shorthand for
BearerTokenMatcher::from_token
. - Shorthand for
BodyExactMatcher::bytes
. - Shorthand for
BodyExactMatcher::json
. - Match an incoming request if its body is encoded as JSON and can be deserialized according to the specified schema.
- Shorthand for
BodyExactMatcher::json_string
. - Shorthand for
BodyPartialJsonMatcher::json
. - Shorthand for
BodyPartialJsonMatcher::json_string
. - Shorthand for
BodyExactMatcher::string
. - Shorthand for
BodyContainsMatcher::string
. - Shorthand for
HeaderExactMatcher::new
. - Shorthand for
HeaderExistsMatcher::new
. - Shorthand for
HeaderRegexMatcher::new
. - Shorthand for
HeaderExactMatcher::new
supporting multi valued headers. - Shorthand for
MethodExactMatcher::new
. - Shorthand for
PathExactMatcher::new
. - Shorthand for
PathRegexMatcher::new
. - Shorthand for
QueryParamExactMatcher::new
. - Shorthand for
QueryParamContainsMatcher::new
. - Shorthand for
QueryParamIsMissingMatcher::new
.