You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WithParam(key, MatchBehaviour.RejectOnMatch, values) inverts the match result #1496
When a request-parameter matcher is configured with a value and MatchBehaviour.RejectOnMatch, the result is inverted: a request whose parameter value equals the reject value matches the mapping (it should be rejected), and a request with a different value does not match (it should be accepted).
Steps to reproduce
varserver=WireMockServer.Start();// "Match this mapping only when query param 'k' is NOT 'abc'."server.Given(Request.Create().UsingGet().WithPath("/x").WithParam("k",MatchBehaviour.RejectOnMatch,"abc")).RespondWith(Response.Create().WithSuccess());varclient=server.CreateClient();// 'k=abc' equals the reject value => should be REJECTED (404), but returns 200.varmatches=awaitclient.GetAsync($"http://localhost:{server.Port}/x?k=abc");Console.WriteLine(matches.StatusCode);// Actual: OK (200) Expected: NotFound (404)// 'k=xyz' does not equal the reject value => should be ACCEPTED (200), but returns 404.varnotMatches=awaitclient.GetAsync($"http://localhost:{server.Port}/x?k=xyz");Console.WriteLine(notMatches.StatusCode);// Actual: NotFound (404) Expected: OK (200)server.Stop();
Expected vs actual
Request
Expected
Actual
GET /x?k=abc
404 (rejected)
200 (matched)
GET /x?k=xyz
200 (accepted)
404 (not matched)
AcceptOnMatch (the default) is unaffected and works correctly.
Activity
Fix wiremock#1496: WithParam RejectOnMatch inverting the match result
Fix wiremock#1496: WithParam RejectOnMatch inverting the match result (…