Module wiremock::matchers[][src]

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

AnyMatcher

Match all incoming requests, regardless of their method, path, headers or body.

BodyContainsMatcher

Match part of the body of a request.

BodyExactMatcher

Match exactly the body of a request.

HeaderExactMatcher

Match exactly the header of a request.

HeaderExistsMatcher

Match exactly the header name of a request. It checks that the header is present but does not validate the value.

MethodExactMatcher

Match exactly the method of a request.

PathExactMatcher

Match exactly the path of a request.

PathRegexMatcher

Match the path of a request against a regular expression.

QueryParamExactMatcher

Match exactly the query parameter of a request.

Functions

any

Shorthand for AnyMatcher.

body_bytes

Shorthand for BodyExactMatcher::bytes.

body_json

Shorthand for BodyExactMatcher::json.

body_json_schema

Match an incoming request if its body is encoded as JSON and can be deserialized according to the specified schema.

body_string

Shorthand for BodyExactMatcher::string.

body_string_contains

Shorthand for BodyContainsMatcher::string.

header

Shorthand for HeaderExactMatcher::new.

header_exists

Shorthand for HeaderExistsMatcher::new.

headers

Shorthand for HeaderExactMatcher::new supporting multi valued headers.

method

Shorthand for MethodExactMatcher::new.

path

Shorthand for PathExactMatcher::new.

path_regex

Shorthand for PathRegexMatcher::new.

query_param

Shorthand for QueryParamExactMatcher::new.