mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-19 23:41:41 +02:00
Updated Request Matching (markdown)
@@ -570,4 +570,40 @@ server
|
|||||||
.RespondWith(Response.Create()
|
.RespondWith(Response.Create()
|
||||||
.WithStatusCode(HttpStatusCode.Unauthorized)
|
.WithStatusCode(HttpStatusCode.Unauthorized)
|
||||||
.WithBody(@"{ ""result"": ""api-key missing""}"));
|
.WithBody(@"{ ""result"": ""api-key missing""}"));
|
||||||
|
```
|
||||||
|
|
||||||
|
A JSON Mapping example looks like:
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"Guid": "29971ff8-4adb-4ec7-8b7d-a2ce6e5ca630",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/doesnot-need-a-key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Headers": [
|
||||||
|
{
|
||||||
|
"Name": "api-key",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "*",
|
||||||
|
"IgnoreCase": true,
|
||||||
|
"RejectOnMatch": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 401,
|
||||||
|
"BodyDestination": "SameAsSource",
|
||||||
|
"Body": "{ \"result\": \"api-key missing\"}",
|
||||||
|
"Headers": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user