Custom response for missing parameter

Hello,

I created a GET action /request with a parameter lastid (request?lastid=123).
I then created 4 examples to customize the response based on the value of this field:

  • in case the request is /request?lastid=0, the returned json is {X};
  • in case the request is /request?lastid=1, the returned json is {Y};
  • in case the request is /request?lastid=2, the returned json is {Z};
  • in case the request is /request or /request?lastid=‘everythingelse’, the returned json is {“error”: “msg”};

The first 3 cases work correctly, unfortunately the last case always returns the same response {Y} as if i called lastid=1.

I read about the possibility to use the x-mock-response-name in the request header but this would require a modification on my application code to include the new header in the request and i don’t want to modify anything.
Also, i read about the matching algorithm but i don’t find a reason why my mock server returns the wrong json.

Any help on this please?

Thanks,
FZ

I deleted the environment and restarded from scratch: now the behavior i was observing is not there anymore.
I still have the problem about ignoring all the values for lastid not in {0,1,2}: currently if i pass lastid=5 in the request for example, the response is the same as lastid=0.

How can I fix that?

Thanks,
FZ