Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mhartigh opened this issue Dec 5, 2019 · 4 comments
Labels

Comments

@mhartigh
Copy link

mhartigh commented 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:https://localhost:10188/Get?PartituurNaam=Eigen%2A%26Corr%2A&Count=50",
      "AbsoluteUrl": "http:https://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?

@StefH
Copy link
Collaborator

StefH commented Dec 5, 2019

Related to #336 ?

@StefH StefH added the question label Dec 5, 2019
@StefH
Copy link
Collaborator

StefH commented Dec 5, 2019

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

@mhartigh
Copy link
Author

mhartigh commented 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?

@StefH
Copy link
Collaborator

StefH commented 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 StefH closed this as completed Dec 9, 2019
@StefH StefH added bug and removed question labels Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants