0
votes

I'm trying to build a decent mock API using Postman, and I stumbled upon its Matching algorithm.
Is there a way to turn it off, so that, for example, when I target the wrong query params, or simply the wrong URL, it does return a 404?

Currently the response from

my/api/path/endpoint?myParam=Test

is returned even when I submit to

my/api/path/endp

Which I really don't want.

1

1 Answers

1
votes

Currently, there is no way to turn off query param matching. If the query params do not match the algorithm falls back to match the path. The path matching is based on a fuzzy string matching algorithm which is why you are getting a response even though you were expecting a 404. One workaround for this is to save another example response for with a response code of 404 for my/api/path/endpoint and then send the x-mock-response-code header key with the value 404. This should return the example you have stored with the 404 status code.