-1

i am very new here. I look up to setup die optional parameters in my Pattern. I have already read the documentary WireMock, but I have not found anything suitable.

My question is, can I query the parameters in any order =?

The next one would is ,y caseInsensitive doesn't work. I dont know why.

{
  "priority": 1,
  "request": {
    "method": "GET",
    "headers": {
      "Content-Type": {
        "equalTo": "application/json",
        "caseInsensitive": true
      }
    },
    "urlPattern": "/example\\?name=([a-zA-Z0-9]*)&id=([a-zA-Z0-9]*)"
  },
  "response": {
    "status": 200,
    "bodyFileName": "example/test.json"
  }
}
chan dee
  • 1
  • 2
  • Can you elaborate on what you mean by "caseInsentive" doesn't work? What exactly about it doesn't work? As you've put it, it only applies to the `Content-Type` header. – agoff Jul 07 '20 at 14:29

2 Answers2

0

As you've written your urlPattern, the query parameter matching is not order indifferent. If you want the query parameters to indifferent, you'd need to do something like...

{
  "priority": 1,
  "request": {
    "method": "GET",
    "headers": {
      "Content-Type": {
        "equalTo": "application/json"
      }
    },
    "urlPath": "/example",
    "queryParameters": {
        "name": {
            "matches": "([a-zA-Z0-9]*)"
        },
        "id": {
            "matches": "([a-zA-Z0-9]*)"
        }
    }
  },
  "response": {
    "status": 200,
    "bodyFileName": "example/test.json"
  }
}
agoff
  • 5,818
  • 1
  • 7
  • 20
  • What's your exact request look like? What is the error that you get? I've updated my response to remove the "caseInsensitive" part because I don't think that is what you want to use here -- the regex matching with a-z and A-Z makes the response case insensitive. Look at the information for regular expression matching: http://wiremock.org/docs/request-matching/#regular-expression. The documentation on url matching mentions to use `queryParameters` for order invariant parameters: http://wiremock.org/docs/request-matching/#url-matching – agoff Jul 09 '20 at 13:01
-1

The result of the query comes back the same answer.

i want, if i call my request, that the order of Parameters doesn't matter.

example Request: /example?name=max&id=01 example2 Request: /example?id=01&name=max

it should be get same Response.

And it should be case-insensitive.

chan dee
  • 1
  • 2
  • Instead of an answer, this should be a comment response on your main question, or as a comment on my answer. – agoff Jul 09 '20 at 13:05