How to match a request with query param #1367
-
Hello, I try to configure a mock for a request like But when I call http://localhost:3001/test?x=2 I get the mock response which I don't expect. I expect to get a 404 since x is not equal to 1. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, If you have a single route response, it will always get served. |
Beta Was this translation helpful? Give feedback.
-
I managed to make it work by adding a 404 response by default. I am evaluating WireMock vs Mockoon as they are very similar for my use cases. The requirement of having a default 404 rule is a real constraint. If the request does not match, it's expected to get a 404 by default as it is in WireMock. Anyway Mockoon is a good alternative. Thx for your quick answer |
Beta Was this translation helpful? Give feedback.
Hi, If you have a single route response, it will always get served.
You must have at least two responses, a default one (blue flag), and some other with rules.
I suggest that you have a look at our reponse rules tutorial to see a typical setup.
I admit that having rules on a single response can be confusing.