mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-27 10:47:01 +02:00
Updated Request Matching (markdown)
@@ -23,6 +23,51 @@ At this moment these matchers are supported:
|
|||||||
* [WildcardMatcher](https://github.com/WireMock-Net/WireMock.Net/wiki/Request-Matching#wildcardmatching-wildcardmatcher)
|
* [WildcardMatcher](https://github.com/WireMock-Net/WireMock.Net/wiki/Request-Matching#wildcardmatching-wildcardmatcher)
|
||||||
|
|
||||||
|
|
||||||
|
## Exact matcher (ExactMatcher)
|
||||||
|
Can be used to exactly match a string or object.
|
||||||
|
|
||||||
|
#### C# option
|
||||||
|
```csharp
|
||||||
|
var server = FluentMockServer.Start();
|
||||||
|
server
|
||||||
|
.Given(Request.Create().WithPath("/exact")
|
||||||
|
.WithParam("from", new ExactMatcher("abc")))
|
||||||
|
.RespondWith(Response.Create()
|
||||||
|
.WithBody("Exact match")
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### JSON Mapping option
|
||||||
|
``` js
|
||||||
|
{
|
||||||
|
"Guid": "67ae335b-5d79-42dc-8ca7-236280ab9111",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/exact"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "from",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "ExactMatcher",
|
||||||
|
"Pattern": "abc"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"Body": "Exact match"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Dynamic Linq (LinqMatcher)
|
## Dynamic Linq (LinqMatcher)
|
||||||
Can be used to match an object using Dynamic Linq (https://github.com/StefH/System.Linq.Dynamic.Core)
|
Can be used to match an object using Dynamic Linq (https://github.com/StefH/System.Linq.Dynamic.Core)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user