Hi I am trying to mock a request using logical ope...
# help
t
Hi I am trying to mock a request using logical operator using wiremock
v2.27.2
. The request is as below:
Copy code
{
  "request": {
    "method": "POST",
    "urlPattern": "sampleRequest",
    "headers": {
      "Authorization": {
        "matches": "\\btestStandardAuthCode(Warn)?\\b"
      }
    },
    "bodyPatterns": [
      {
        "matchesJsonPath": {
          "expression": "$.date",
          "and": [
            {
              "before": "2022-01-01T00:00:00"
            },
            {
              "after": "2020-01-01T00:00:00"
            }
          ]
        }
      }
    ]
  },
  "response": {
    "status": 200,
    "bodyFileName": "body/sampleresponse.json"
  }
}
However when I running it, I am getting the below error
Copy code
com.github.tomakehurst.wiremock.standalone.MappingFileException:
{"expression":"$.date","and":[{"before":"2022-01-01T00:00:00"},{"after":"2020-01-01T00:00:00"}]} is not a valid match operation
t
Logical AND and OR weren’t introduced until much later. I suggest upgrading to 2.35.0 at least, or better still 3.0.0-beta-15.