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

JsonMatcher does not match a body containing an array of strings #390

Closed
mhartigh opened this issue Dec 12, 2019 · 4 comments
Closed

JsonMatcher does not match a body containing an array of strings #390

mhartigh opened this issue Dec 12, 2019 · 4 comments
Labels

Comments

@mhartigh
Copy link

mhartigh commented Dec 12, 2019

Hi,

This scenario did work on version 1.32 but since 1.33 the mapping does not match anymore. I have also tried version 1.40 but no difference. Am I supposed to apply a different approach?

We have the following mapping:

    "Guid": "1a48bb7d-c073-4b1c-85a8-09d4409a6e57",
    "Priority": 10,
    "Request": {
      "Path": {
        "Matchers": [
          {
            "Name": "WildcardMatcher",
            "Pattern": "/Events/Annuleren",
            "IgnoreCase": true
          }
        ]
      },
      "Methods": [
        "POST"
      ],
      "Body": {
        "Matcher": {
          "Name": "JsonMatcher",
          "Pattern": "[\"0455baac-37d8-4a5e-9240-d2af254c7e66\",\"0455baac-37d8-4a5e-9240-d2af254c7e70\"]",
          "IgnoreCase": true
        }
      }
    },
    "Response": {
      "StatusCode": 200,
      "Headers": {}
    }

The following request does not match:

    "Guid": "dcd35ec5-13c3-4908-8822-b8c04a09b548",
    "Request": {
      "ClientIP": "xx.xx.xx.xx",
      "DateTime": "2019-12-12T09:41:49.7304608Z",
      "Path": "/Events/Annuleren",
      "AbsolutePath": "/Events/Annuleren",
      "Url": "https://localhost:10862/Events/Annuleren",
      "AbsoluteUrl": "https://localhost:10862/Events/Annuleren",
      "Query": {},
      "Method": "POST",
      "Headers": {
        "Connection": [
          "keep-alive"
        ],
        "Content-Type": [
          "text/plain"
        ],
        "Accept": [
          "*/*"
        ],
        "Accept-Encoding": [
          "gzip, deflate"
        ],
        "Host": [
          "localhost:10862"
        ],
        "User-Agent": [
          "PostmanRuntime/7.11.0"
        ],
        "Content-Length": [
          "79"
        ]
      },
      "Body": "[\"0455baac-37d8-4a5e-9240-d2af254c7e66\",\"0455baac-37d8-4a5e-9240-d2af254c7e70\"]",
      "BodyAsJson": [
        "0455baac-37d8-4a5e-9240-d2af254c7e66",
        "0455baac-37d8-4a5e-9240-d2af254c7e70"
      ],
      "BodyEncoding": {
        "CodePage": 65001,
        "EncodingName": "Unicode (UTF-8)",
        "WebName": "utf-8"
      },
      "DetectedBodyType": "Json",
      "DetectedBodyTypeFromContentType": "String"
    },
    "Response": {
      "StatusCode": 404,
      "Headers": {
        "Content-Type": [
          "application/json"
        ]
      },
      "BodyAsJson": {
        "Status": "No matching mapping found"
      },
      "DetectedBodyType": 2,
      "DetectedBodyTypeFromContentType": 0
    }

Thanks for your help!

@StefH
Copy link
Collaborator

StefH commented Dec 12, 2019

This behavior was changed since 1.0.33 and I did not test this specific scenario.
I will take a look at the code.

@StefH StefH added the bug label Dec 12, 2019
@StefH
Copy link
Collaborator

StefH commented Dec 12, 2019

@mhartigh Can you please try this version (WireMock.Net.1.0.40-ci-12333) from MyGet.

@mhartigh
Copy link
Author

mhartigh commented Dec 13, 2019

@mhartigh Can you please try this version (WireMock.Net.1.0.40-ci-12333) from MyGet.

HI Stef,

Thank you! This version does work properly!

Regards

@StefH
Copy link
Collaborator

StefH commented Dec 13, 2019

OK, I'll create a new official NuGet tomorrow.

@StefH StefH closed this as completed Dec 13, 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