Updated Request Matching (markdown)

Stef Heyenrath
2023-03-23 21:51:43 +01:00
parent 6fee32a759
commit 42f7d3974e

@@ -4,11 +4,17 @@ WireMock.Net supports matching of requests to stubs and verification queries usi
* Path
* URL
* HTTP Method
* Query parameters
* Headers
* [Query parameters](#query-parameters)
* [Headers](#headers)
* Cookies
* Request Body
## Generic information on matchers:
Most matchers have 2 extra properties:
- IgnoreCase = define that the matcher should match ignoring the case
- RejectOnMatch = define that when the matcher does match successfully, this should be counted as a invalid (non-matching) match
## Example Matching for the elements
### Query Parameters
@@ -39,6 +45,47 @@ server
}
```
### Headers
#### C#
``` c#
// todo
```
#### JSON
``` json
{
"Request": {
"Headers": [
{
"Name": "api-key",
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "abc*"
"IgnoreCase": true
}
]
}
]
}
}
```
Note that when you want to match on a missing header, you need to use this mapping:
``` json
{
"Request": {
"Headers": [
{
"Name": "api-key",
"IgnoreCase": true,
"RejectOnMatch": true
}
}
]
```
This means that when the header-key `api-key` (ignoring the casing) is missing the header mapping will match because `RejectOnMatch` is `true`.
# :two: Matchers
The following paragraphs describe in detail which matchers can be used.