How to switch mock server request's response from all example?

Here is a mock server and API01, 3 examples of API01.

ex1: HTTP200 response sample
ex2: HTTP400 response sample
ex3: HTTP401 response sample. Latest created.

My question is how to change response from 3 examples.
It seems mock server response is always latest example (ex3).
So if I want to switch to ex1 from ex3, I have to delete ex1 and create ex4 (contents is just same of ex1)?

Hey @abet,

Mock requests also accept optional headers. So if you use the x-mock-response-code header and set it’s value to 200/ 400/ or 401- you’ll get the corresponding response sample. If this header is not provided, the closest match of any response code will be returned.

Here’s the official documentation of this- https://learning.getpostman.com/docs/postman/mock-servers/mock-with-api/#run-the-mock-service

Cheers,

1 Like

Thanks!
x-mock-response-code header is what I want!!

1 Like