Updated Request Matcher : FormUrlEncodedMatcher (markdown)

Stef Heyenrath
2024-07-27 11:29:20 +02:00
parent 983ed9f627
commit 94a76e3106

@@ -4,7 +4,16 @@ Can be used to check if a Form Url Encoded body contains the key-value pairs.
#### C# option #### C# option
```csharp ```csharp
var server = WireMockServer.Start(); var server = WireMockServer.Start();
// todo server.Given(
Request.Create()
.UsingPost()
.WithPath("/foo")
.WithHeader("Content-Type", "application/x-www-form-urlencoded")
.WithBody(new FormUrlEncodedMatcher(["name=John Doe", "email=johndoe@example.com"]))
)
.RespondWith(
Response.Create()
);
``` ```
#### JSON Mapping option #### JSON Mapping option
@@ -15,7 +24,7 @@ var server = WireMockServer.Start();
"Matchers": [ "Matchers": [
{ {
"Name": "WildcardMatcher", "Name": "WildcardMatcher",
"Pattern": "/api" "Pattern": "/foo"
} }
] ]
}, },
@@ -41,7 +50,8 @@ var server = WireMockServer.Start();
"grant_type=client_credentials", "grant_type=client_credentials",
"client_id=DDCD99EE1531484E4E21D5EC9FBA5D8B", "client_id=DDCD99EE1531484E4E21D5EC9FBA5D8B",
"client_secret=RERDRDk5RUUxNTMxNDg0RTRFMjFENUVDOUZCQTVEOEI%3D" "client_secret=RERDRDk5RUUxNTMxNDg0RTRFMjFENUVDOUZCQTVEOEI%3D"
] ],
"IgnoreCase": true
} }
} }
}, },