LukeMathWalker / wiremock-rs

HTTP mocking to test Rust applications.
Apache License 2.0
617 stars 70 forks source link

Add QueryParamIsMissingMatcher #88

Closed SebRollen closed 2 years ago

SebRollen commented 2 years ago

Sometimes it can be useful to match a request for an explicitly missing parameter. For example, APIs often have a default behavior if a query parameter is not passed. A user could therefore want to set up two mocks - one which should respond to a missing query parameter and another that should respond to an exact query parameter. This is tricky currently as we cannot just create the first mock without the query matcher as this would also match requests that do contain the query.

This PR adds a matcher that only matches requests that do not contain a specific query parameter.

LukeMathWalker commented 2 years ago

Sorry for the very late review - this is looking good, just a naming question.