From 983ed9f62752b29ab9b02bb34775f8d8e43736f5 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Sat, 27 Jul 2024 11:27:09 +0200 Subject: [PATCH] Created Request Matcher : FormUrlEncodedMatcher (markdown) --- Request-Matcher-:-FormUrlEncodedMatcher.md | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Request-Matcher-:-FormUrlEncodedMatcher.md diff --git a/Request-Matcher-:-FormUrlEncodedMatcher.md b/Request-Matcher-:-FormUrlEncodedMatcher.md new file mode 100644 index 0000000..34fa6cc --- /dev/null +++ b/Request-Matcher-:-FormUrlEncodedMatcher.md @@ -0,0 +1,60 @@ +## FormUrlEncodedMatcher +Can be used to check if a Form Url Encoded body contains the key-value pairs. + +#### C# option +```csharp +var server = WireMockServer.Start(); +// todo +``` + +#### JSON Mapping option +``` json +{ + "Request": { + "Path": { + "Matchers": [ + { + "Name": "WildcardMatcher", + "Pattern": "/api" + } + ] + }, + "Methods": [ + "POST" + ], + "Headers": [ + { + "Name": "Content-Type", + "Matchers": [ + { + "Name": "WildcardMatcher", + "Pattern": "application/x-www-form-urlencoded", + "IgnoreCase": true + } + ] + } + ], + "Body": { + "Matcher": { + "Name": "FormUrlEncodedMatcher", + "Patterns": [ + "grant_type=client_credentials", + "client_id=DDCD99EE1531484E4E21D5EC9FBA5D8B", + "client_secret=RERDRDk5RUUxNTMxNDg0RTRFMjFENUVDOUZCQTVEOEI%3D" + ] + } + } + }, + "Response": { + "StatusCode": 200, + "BodyAsJson": { + "access_token": "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJjbGllbnRUeXBlIjoiU2VydmVyIiwiYXVkIjoidHJhbnNhY3Rpb24iLCJuYmYiOjE3MjE3MjU2NDMsImV4cCI6MTcyMjMzMDQ0MywiaWF0IjoxNzIxNzI1NjQzfQ.", + "token_type": "Bearer", + "expires_in": 3599 + }, + "Headers": { + "Content-Type": "application/json" + } + } +} +```