Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set default response (example) in Postman

I have setup a mock server in Postman.

For a request X, I have added 2 examples (responses)

  1. 200 Success Response
  2. 400 Bad request

When I use x-mock-response-code I am able to get the appropriate response.

But when I dont use the x-mock-response-code, I am always getting 400 Bad Request. I am expecting 200 by default. But its not happening.

Do I need to add some thing to example response ? I tried to change example name as Default but no use..

like image 737
renjuwm Avatar asked Nov 07 '22 00:11

renjuwm


1 Answers

If your example requests are identical, Postman will deterministically return the response for one of them. There is no concept of 'default' examples at this time. If you want a particular response to be returned, make sure your example requests are not identical and only one example request matches the request you are sending. Or use the x-mock-response-code header as you are already doing.

like image 93
Pranaya Tomar Avatar answered Nov 28 '22 00:11

Pranaya Tomar