mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-12 05:22:23 +01:00
Updated Request Matching (markdown)
@@ -1,8 +1,8 @@
|
||||
# :one: Request Matching
|
||||
WireMock.Net supports matching of requests to stubs and verification queries using the following parts:
|
||||
|
||||
* Path
|
||||
* URL
|
||||
* [Path] (#path)
|
||||
* [URL](#url)
|
||||
* HTTP Method
|
||||
* [Query parameters](#query-parameters)
|
||||
* [Headers](#headers)
|
||||
@@ -15,10 +15,62 @@ 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
|
||||
## 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
|
||||
#### C# excerpt
|
||||
#### C# example
|
||||
``` c#
|
||||
server
|
||||
.Given(Request
|
||||
@@ -26,7 +78,7 @@ server
|
||||
.WithParam("search", "abc")
|
||||
```
|
||||
|
||||
#### JSON excerpt
|
||||
#### JSON example
|
||||
``` json
|
||||
{
|
||||
"Request": {
|
||||
|
||||
Reference in New Issue
Block a user