I have a GET request with the URL: {{url}}/provinces?id=
(where I send the ID of the province I want to retrieve, only IDs 1 to 7 exist and are valid). I created 7 examples for this request, each with a different key-value pair (the key is the ID). If the value is 1, it returns the JSON object for the province with ID=1 and the status is 200 OK. The same applies for examples with ID=2, ID=3, β¦, ID=7.
Now, I need to create a simulation of a 404 error with a customized response that works when attempting to request any ID other than the existing ones. For example, if I send ID=0, 8, 345, 45lkhh, sldfgfliE, I want it to return a 404 with my custom response. I created a new example with a URL that includes a non-existent ID (ID=456) because I read somewhere that this would work to return a 404 for any request with an ID outside the range of 1 to 7. I changed its status to 404 Not Found, but itβs not working. In this case, it only returns a 404 if I request {{url}}/provinces?id=456
from the client. However, if I use 789, which also doesnβt exist, it applies the matching algorithm and returns a province that does exist with a 200 status code.
I appreciate your help in knowing how to configure a simulation of an error correctly.
Screenshot for the main request:
Screenshot about how the id=1 to id=7 are created:
Screenshot about how the β404 Not Foundβ customized example is created: