Matching the request’s URL
contains
rater than
exact equality.
To do this, you need to change the URL match type in the Advanced section to Path
and ensure you only specify a path in the URL field e.g.
Path regex
match type can be particularly useful in cases where
the API you’re mocking uses path parameters and you wish to provide a meaningful response
to a specific URL pattern regardless of the specific parameter values.
For instance, choosing Path regex
as the match type with the following URL
note Using the Path and query regex is generally not advised. This exists primarily for compatibility with projects exported to/from WireMock.
request.path.thingId
rather than request.path.1
).
To configure a stub to use the path template URL match type, enter a path value that declares one or more path variables
using square bracket syntax (e.g. /things/{thingId}
) and select the “Path template” URL match type.
Now you can add path parameters that match against the value of a request’s path variables.
Any URL
option from the URL match type list under Advanced.