Query string parameter value which contains %26 does not work with ExactMatcher #233

Closed
opened 2025-12-29 15:18:51 +01:00 by adam · 4 comments
Owner

Originally created by @mhartigh on GitHub (Dec 5, 2019).

Hi,

I am trying to get a mapping matched with the ExactMatcher but I can't succeed to make it work.

The input value on the form is escaped with Uri.EscapeDataString before the GET request is fired but every GET request results in a "404 - No matching mapping found".

It does look like wiremock cannot deal with querystring values containing a & (%26) because this will result in a separate parameter.

Mapping:

    "Guid": "0c426e65-9331-484c-a47a-631a347d1e19",
    "Priority": 10,
    "Request": {
      "Path": {
        "Matchers": [
          {
            "Name": "WildcardMatcher",
            "Pattern": "/Get"
          }
        ]
      },
      "Methods": [
        "GET"
      ],
      "Params": [
        {
          "Name": "Count",
          "IgnoreCase": true,
          "Matchers": [
            {
              "Name": "ExactMatcher",
              "Pattern": "50"
            }
          ]
        },
        {
          "Name": "PartituurNaam",
          "IgnoreCase": true,
          "Matchers": [
            {
              "Name": "ExactMatcher",
              "Pattern": "Eigen*&Corr*"
            }
          ]
        }
      ]
    },
    "Response": {
      "StatusCode": 200,
      "BodyAsJson": [
        {
          "Id": "0455BAAC-37D8-4A5E-9240-D2AF254C7E67"
        }
      ]
    }

Request:


    "Guid": "b67618c9-d2d3-453f-a850-1494c6da26f2",
    "Request": {
      "ClientIP": "127.0.0.1",
      "DateTime": "2019-12-05T13:09:14.997873Z",
      "Path": "/Get",
      "AbsolutePath": "/Get",
      "Url": "http://localhost:10188/Get?PartituurNaam=Eigen%2A%26Corr%2A&Count=50",
      "AbsoluteUrl": "http://localhost:10188/Get?PartituurNaam=Eigen%2A%26Corr%2A&Count=50",
      "Query": {
        "PartituurNaam": [
          "Eigen*"
        ],
        "Corr*": [],
        "AantalTonen": [
          "50"
        ]
      },
      "Method": "GET",
      "Headers": {
        "Accept": [
          "application/json"
        ],
        "Host": [
          "localhost:10188"
        ] 
      }
    },
    "Response": {
      "StatusCode": 404,
      "Headers": {
        "Content-Type": [
          "application/json"
        ]
      },
      "BodyAsJson": {
        "Status": "No matching mapping found"
      },
      "DetectedBodyType": 2,
      "DetectedBodyTypeFromContentType": 0
    }

Do you have any idea how to work around this?

Originally created by @mhartigh on GitHub (Dec 5, 2019). Hi, I am trying to get a mapping matched with the ExactMatcher but I can't succeed to make it work. The input value on the form is escaped with Uri.EscapeDataString before the GET request is fired but every GET request results in a "_404 - No matching mapping found_". It does look like wiremock cannot deal with querystring values containing a & (%26) because this will result in a separate parameter. Mapping: ```js "Guid": "0c426e65-9331-484c-a47a-631a347d1e19", "Priority": 10, "Request": { "Path": { "Matchers": [ { "Name": "WildcardMatcher", "Pattern": "/Get" } ] }, "Methods": [ "GET" ], "Params": [ { "Name": "Count", "IgnoreCase": true, "Matchers": [ { "Name": "ExactMatcher", "Pattern": "50" } ] }, { "Name": "PartituurNaam", "IgnoreCase": true, "Matchers": [ { "Name": "ExactMatcher", "Pattern": "Eigen*&Corr*" } ] } ] }, "Response": { "StatusCode": 200, "BodyAsJson": [ { "Id": "0455BAAC-37D8-4A5E-9240-D2AF254C7E67" } ] } ``` Request: ``` js "Guid": "b67618c9-d2d3-453f-a850-1494c6da26f2", "Request": { "ClientIP": "127.0.0.1", "DateTime": "2019-12-05T13:09:14.997873Z", "Path": "/Get", "AbsolutePath": "/Get", "Url": "http://localhost:10188/Get?PartituurNaam=Eigen%2A%26Corr%2A&Count=50", "AbsoluteUrl": "http://localhost:10188/Get?PartituurNaam=Eigen%2A%26Corr%2A&Count=50", "Query": { "PartituurNaam": [ "Eigen*" ], "Corr*": [], "AantalTonen": [ "50" ] }, "Method": "GET", "Headers": { "Accept": [ "application/json" ], "Host": [ "localhost:10188" ] } }, "Response": { "StatusCode": 404, "Headers": { "Content-Type": [ "application/json" ] }, "BodyAsJson": { "Status": "No matching mapping found" }, "DetectedBodyType": 2, "DetectedBodyTypeFromContentType": 0 } ``` Do you have any idea how to work around this?
adam added the bug label 2025-12-29 15:18:51 +01:00
adam closed this issue 2025-12-29 15:18:51 +01:00
Author
Owner

@StefH commented on GitHub (Dec 5, 2019):

Related to https://github.com/WireMock-Net/WireMock.Net/issues/336 ?

@StefH commented on GitHub (Dec 5, 2019): Related to https://github.com/WireMock-Net/WireMock.Net/issues/336 ?
Author
Owner

@StefH commented on GitHub (Dec 5, 2019):

@mhartigh
It should be fixed, can you please test version WireMock.Net.1.0.38-ci-12272.nupkg from MyGet?

@StefH commented on GitHub (Dec 5, 2019): @mhartigh It should be fixed, can you please test version `WireMock.Net.1.0.38-ci-12272.nupkg` from MyGet?
Author
Owner

@mhartigh commented on GitHub (Dec 9, 2019):

@mhartigh
It should be fixed, can you please test version WireMock.Net.1.0.38-ci-12272.nupkg from MyGet?

@StefH Yes this package has the correct behavior. Thank you very much!,

What do you suggest. To stick with this package for a while or will the fix be included in a release version very soon?

@mhartigh commented on GitHub (Dec 9, 2019): > > > @mhartigh > It should be fixed, can you please test version `WireMock.Net.1.0.38-ci-12272.nupkg` from MyGet? @StefH Yes this package has the correct behavior. Thank you very much!, What do you suggest. To stick with this package for a while or will the fix be included in a release version very soon?
Author
Owner

@StefH commented on GitHub (Dec 9, 2019):

I can plan to release a new official version tonight. Just keep an eye on this issue, when it's closed then you can switch to the official NuGet.

@StefH commented on GitHub (Dec 9, 2019): I can plan to release a new official version tonight. Just keep an eye on this issue, when it's closed then you can switch to the official NuGet.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#233