mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-21 08:21:53 +02:00
Updated Request Matching (markdown)
@@ -1,8 +1,8 @@
|
|||||||
# :one: Request Matching
|
# :one: Request Matching
|
||||||
WireMock.Net supports matching of requests to stubs and verification queries using the following parts:
|
WireMock.Net supports matching of requests to stubs and verification queries using the following parts:
|
||||||
|
|
||||||
* Path
|
* [Path] (#path)
|
||||||
* URL
|
* [URL](#url)
|
||||||
* HTTP Method
|
* HTTP Method
|
||||||
* [Query parameters](#query-parameters)
|
* [Query parameters](#query-parameters)
|
||||||
* [Headers](#headers)
|
* [Headers](#headers)
|
||||||
@@ -15,10 +15,62 @@ Most matchers have 2 extra properties:
|
|||||||
- IgnoreCase = define that the matcher should match ignoring the case
|
- 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
|
- RejectOnMatch = define that when the matcher does match successfully, this should be counted as a invalid (non-matching) match
|
||||||
|
|
||||||
## Example Matching for the elements
|
## Example Matchings
|
||||||
|
|
||||||
|
### Path
|
||||||
|
### C# example
|
||||||
|
``` c#
|
||||||
|
server
|
||||||
|
.Given(Request
|
||||||
|
.Create()
|
||||||
|
.WithPath("/test")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### JSON example
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/path",
|
||||||
|
"IgnoreCase": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
|
### Url
|
||||||
|
### C# example
|
||||||
|
``` c#
|
||||||
|
server
|
||||||
|
.Given(Request
|
||||||
|
.Create()
|
||||||
|
.WithUrl("https://localhost/test")
|
||||||
|
```
|
||||||
|
|
||||||
|
#### JSON example
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"Request": {
|
||||||
|
"Url": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "RegexMatcher",
|
||||||
|
"Pattern": "/clients[?]",
|
||||||
|
"IgnoreCase": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
````
|
||||||
|
|
||||||
### Query Parameters
|
### Query Parameters
|
||||||
#### C# excerpt
|
#### C# example
|
||||||
``` c#
|
``` c#
|
||||||
server
|
server
|
||||||
.Given(Request
|
.Given(Request
|
||||||
@@ -26,7 +78,7 @@ server
|
|||||||
.WithParam("search", "abc")
|
.WithParam("search", "abc")
|
||||||
```
|
```
|
||||||
|
|
||||||
#### JSON excerpt
|
#### JSON example
|
||||||
``` json
|
``` json
|
||||||
{
|
{
|
||||||
"Request": {
|
"Request": {
|
||||||
|
|||||||
Reference in New Issue
Block a user