A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/wiremock/WireMock.Net/wiki/Request-Matching below:

Request Matching · wiremock/WireMock.Net Wiki · GitHub

WireMock.Net supports matching of requests to stubs and verification queries using the following parts:

Generic information on matchers:

Most matchers have 2 extra properties:

server
  .Given(Request
    .Create()
      .WithPath("/test")
{
  "Request": {
    "Path": {
      "Matchers": [
        {
          "Name": "WildcardMatcher",
          "Pattern": "/path",
          "IgnoreCase": true
        }
      ]
    }
  }
}
server
  .Given(Request
    .Create()
      .WithUrl("https://localhost/test")
{
  "Request": {
    "Url": {
      "Matchers": [
        {
          "Name": "RegexMatcher",
          "Pattern": "/clients[?]",
          "IgnoreCase": true
        }
      ]
    }
  }
}
server
  .Given(Request
    .Create()
      .WithParam("search", "abc")
{
     "Request": {
        "Params": [
            {
                "Name": "search",
                "Matchers": [
                    {
                        "Name": "ExactMatcher",
                        "Pattern": "abc"
                    }
                ]
            }
        ]
    }
}
{
  "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:

{
  "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.

Content moved to Request Matchers.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4