Block/delay API response

Hi all,

Looking for a way to block/delay an API response. Trying to test timeout on an endpoint thats set to 10 secs and want to see if I can block/delay the call beyond 10secs (ex 1 minute), to assure the call timeout at 10secs.

Hey!

Postman has a setting that you can change in Settings > General > Request timeout in milliseconds that you can set if you want to set an explicit timeout (default infinite).

You can also do something similar programmatically in your tests to make sure your response times are under a certain threshold. This way, when you run the request, the test will fail if it’s slower than whatever you have defined.

pm.test("Response time is less than 10s", function () {
    pm.expect(pm.response.responseTime).to.be.below(10000);
});

If you’re looking to test the timeout functionality from your API’s side, you’d likely have to write a delay in the actual API/endpoint outside of Postman.

Hope this helps! :smile: