From c554646bbb179cc5408314f09da6c041114d427e Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Thu, 10 Aug 2023 07:59:59 +0200 Subject: [PATCH] Updated Request Matching (markdown) --- Request-Matching.md | 62 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/Request-Matching.md b/Request-Matching.md index a354ba2..b742f31 100644 --- a/Request-Matching.md +++ b/Request-Matching.md @@ -1,8 +1,8 @@ # :one: Request Matching WireMock.Net supports matching of requests to stubs and verification queries using the following parts: -* Path -* URL +* [Path] (#path) +* [URL](#url) * HTTP Method * [Query parameters](#query-parameters) * [Headers](#headers) @@ -15,10 +15,62 @@ Most matchers have 2 extra properties: - IgnoreCase = define that the matcher should match ignoring the case - RejectOnMatch = define that when the matcher does match successfully, this should be counted as a invalid (non-matching) match -## Example Matching for the elements +## Example Matchings + +### Path +### C# example +``` c# +server + .Given(Request + .Create() + .WithPath("/test") +``` + +#### JSON example +``` json +{ + "Request": { + "Path": { + "Matchers": [ + { + "Name": "WildcardMatcher", + "Pattern": "/path", + "IgnoreCase": true + } + ] + } + } +} +```` + +### Url +### C# example +``` c# +server + .Given(Request + .Create() + .WithUrl("https://localhost/test") +``` + +#### JSON example +``` json +{ + "Request": { + "Url": { + "Matchers": [ + { + "Name": "RegexMatcher", + "Pattern": "/clients[?]", + "IgnoreCase": true + } + ] + } + } +} +```` ### Query Parameters -#### C# excerpt +#### C# example ``` c# server .Given(Request @@ -26,7 +78,7 @@ server .WithParam("search", "abc") ``` -#### JSON excerpt +#### JSON example ``` json { "Request": {