0

I have very basic mapping.json

{
    "mappings": [
        {
            "priority": 1,
            "request": {
                "method": "GET",
                "url": "/your/url?and=query"
            },
            "response": {
                "status": 200,
                "statusMessage": "query param test"
            }
        },
        {
            "priority": 2,
            "request": {
                "method": "GET",
                "url": "/your"
            },
            "response": {
                "status": 200,
                "statusMessage": "no query param"
            }
        }
    ]
}

It's the exact same example as given in the documentation.

Result:

admin ~ % curl -i http://localhost:8081/your
HTTP/1.1 200 no query param
Matched-Stub-Id: 6ff84303-8abb-48d0-bd27-679de118afc7
Transfer-Encoding: chunked
Server: Jetty(9.2.z-SNAPSHOT)

admin ~ % curl -i http://localhost:8081/your/url?and=query
zsh: no matches found: http://localhost:8081/your/url?and=query
admin ~ % 

Cannot figure out what I am doing wrong here. It's exactly the same example give in the documentation. I tried putting query parameter like this:

"queryParameters" : {
      "search_term" : {
        "equalTo" : "WireMock"
      }
    },

This also didn't help. TIA

Mohammed
  • 637
  • 13
  • 26

1 Answers1

0

Check out the answer and comment from this question, but the tl;dr is that if you want to include query parameters in a CURL request, you have to have the URL in quotes.

That would explain why Postman worked, and the CURL request without query parameters also worked, but the CURL request with query parameters did not.

curl -i 'http://localhost:8081/your/url?and=query' should be enough to solve your problem (might need double quotes instead of single?)

agoff
  • 5,818
  • 1
  • 7
  • 20