mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-18 07:24:34 +01:00
Updated Request Matcher : FormUrlEncodedMatcher (markdown)
@@ -4,7 +4,16 @@ Can be used to check if a Form Url Encoded body contains the key-value pairs.
|
||||
#### C# option
|
||||
```csharp
|
||||
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
|
||||
@@ -15,7 +24,7 @@ var server = WireMockServer.Start();
|
||||
"Matchers": [
|
||||
{
|
||||
"Name": "WildcardMatcher",
|
||||
"Pattern": "/api"
|
||||
"Pattern": "/foo"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -41,7 +50,8 @@ var server = WireMockServer.Start();
|
||||
"grant_type=client_credentials",
|
||||
"client_id=DDCD99EE1531484E4E21D5EC9FBA5D8B",
|
||||
"client_secret=RERDRDk5RUUxNTMxNDg0RTRFMjFENUVDOUZCQTVEOEI%3D"
|
||||
]
|
||||
],
|
||||
"IgnoreCase": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user