Hi everyone, I'm using wiremock to stub a response...
# general
Hi everyone, I'm using wiremock to stub a response and I'm having trouble with request matching.
Copy code
  .withQueryParam("search_term", equalTo("WireMock"))
  .withQueryParam("search_term", equalTo("Wireshark"))
I have a stub like this that works fine initially, but when I make another stub that would change out "WireMock" for something else like "HungryAnts", it would still make the response for the above stub. So I'm wondering should I use equalTo or something else when I use queryParam? I want my stub to go to the exact file that has this specific url.
Hi Terry, are you actually calling
twice on one stub for the same parameter name? That won’t work - the second call will overwrite the first. If you create two separate stubs that are the same but with different values inside
I think this will do what you’re looking for.
The endpoint is supposed to look similar to this /id=111&id=222 /id=111,222 I didn't know how to go about simulating multiple query parameter of the same name
Do you need to say id must = 111 AND id must = 222 for the match to happen? If so, this isn’t possible at the moment, but there is a PR in the works to make it so. If just the 222 value on its own is enough however, you can just specify that and it’ll match even if it’s not the only value of id.
Awesome, that's understandable. I think I'll try to use a work around to get by. Thank you for helping me out!
No worries!