mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 15:34:42 +01:00
Created Request Matcher : FormUrlEncodedMatcher (markdown)
60
Request-Matcher-:-FormUrlEncodedMatcher.md
Normal file
60
Request-Matcher-:-FormUrlEncodedMatcher.md
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user