WireMock Cloud
WireMock Cloud’s web-based editor with embedded test tool makes advanced matching setups easy
Learn more >
WireMock Cloud
WireMock Cloud’s web-based editor with embedded test tool makes advanced matching setups easy
Learn more >
WireMock.Net supports matching of requests to stubs and verification queries using the following parts:
Most matchers have 2 extra properties:
server .Given(Request .Create() .WithPath("/test"){ "Request": { "Path": { "Matchers": [ { "Name": "WildcardMatcher", "Pattern": "/path", "IgnoreCase": true } ] } }}server .Given(Request .Create() .WithUrl("https://localhost/test"){ "Request": { "Url": { "Matchers": [ { "Name": "RegexMatcher", "Pattern": "/clients[?]", "IgnoreCase": true } ] } }}server .Given(Request .Create() .WithParam("search", "abc"){ "Request": { "Params": [ { "Name": "search", "Matchers": [ { "Name": "ExactMatcher", "Pattern": "abc" } ] } ] }}// todo{ "Request": { "Headers": [ { "Name": "api-key", "Matchers": [ { "Name": "WildcardMatcher", "Pattern": "abc*" "IgnoreCase": true } ] } ] }}Note that when you want to match on a missing header, you need to use this mapping:
{ "Request": { "Headers": [ { "Name": "api-key", "IgnoreCase": true, "RejectOnMatch": true } ]}This means that when the header-key api-key (ignoring the casing) is missing the header mapping will match because RejectOnMatch is true.
Content moved to Request Matchers.