My complete reference for WireMock Request Matching

Jun Wei Ng
1 min readOct 18, 2019

--

This article serves as my personal complete reference for using Request Matching in WireMock, and will be updated as my usage increases.

What will be covered:

  • Matching URL
  • Matching request body (in JSON)

Matching URL

This section covers matching the URL path of the request.

Techniques covered:

  • Matching the full URL (path and query) using strict equality
  • Matching the full URL (path and query) using regular expression
  • Matching only the path using strict equality
  • Matching only the path using regular expression

Matching the full URL (path and query) using strict equality

Matching the full URL (path and query) using regular expression

Matching only the path using strict equality

Matching only the path using regular expression

Matching request body (in JSON)

This section covers matching the JSON object found in the request body.

Techniques covered:

  • Attribute or item containing substring
  • Attribute is present
  • Attribute value match using strict equality
  • Attribute value match using regular expression
  • Attribute value negative match using regular expression
  • Array contains object with attribute
  • Array contains object with attribute value match using strict equality
  • Array contains object with attribute value match using regular expression
  • Array is of size

Attribute or item containing substring

Attribute is present

Attribute value match using strict equality

Attribute value match using regular expression

Attribute value negative match using regular expression

Array contains object with attribute

Array contains object with attribute value match using strict equality

Array contains object with attribute value match using regular expression

Array is of size

--

--

Jun Wei Ng

Software developer @ Thoughtworks. Opinions are my own