mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-12 21:35:55 +01:00
Updated Request Matching (markdown)
@@ -420,7 +420,6 @@ Hi WM
|
||||
```csharp
|
||||
var server = FluentMockServer.Start();
|
||||
server
|
||||
.AllowPartialMatching()
|
||||
.Given(
|
||||
Request.Create().WithPath("/reg").UsingGet()
|
||||
.WithBody(new SimMetricsMatcher("The cat walks in the street."));
|
||||
@@ -437,9 +436,10 @@ Hello
|
||||
```
|
||||
|
||||
|
||||
### WildcardMatching (WildcardMatch)
|
||||
### WildcardMatching (WildcardMatcher)
|
||||
WildcardMatching is mostly used for Path and Url matching. This matcher allows a ? for a single character and * for any characters.
|
||||
|
||||
#### Option 1
|
||||
```csharp
|
||||
var server = FluentMockServer.Start();
|
||||
server
|
||||
@@ -447,9 +447,15 @@ server
|
||||
.RespondWith(Response.Create().WithBody("Hello"));
|
||||
```
|
||||
|
||||
```
|
||||
// matching
|
||||
Url like /somebody and /something
|
||||
#### Option 2
|
||||
```csharp
|
||||
var server = FluentMockServer.Start();
|
||||
server
|
||||
.Given(
|
||||
Request.Create().WithPath("/wc").UsingGet()
|
||||
.WithBody(new WildcardMatcher("x."));
|
||||
)
|
||||
.RespondWith(Response.Create().WithBody("Matched with *"));
|
||||
```
|
||||
|
||||
### Reversing the match behaviour with `MatchBehaviour.RejectOnMatch`
|
||||
|
||||
Reference in New Issue
Block a user