0
0
Postmantesting~10 mins

Delay between requests in Postman - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a delay of 2 seconds between requests in Postman using JavaScript.

Postman
setTimeout(function() { pm.sendRequest(request, function (err, res) { console.log(res); }); }, [1]);
Drag options to blanks, or click blank then click option'
A2000
B2
C20
D0.2
Attempts:
3 left
💡 Hint
Common Mistakes
Using seconds directly instead of milliseconds.
Using decimal values like 0.2 which are too short.
2fill in blank
medium

Complete the code to pause the test script for 1 second before sending the next request in Postman.

Postman
pm.test('Pause for 1 second', function(done) { setTimeout(done, [1]); });
Drag options to blanks, or click blank then click option'
A100
B1000
C10
D5000
Attempts:
3 left
💡 Hint
Common Mistakes
Using 100 instead of 1000, which causes only 0.1 second delay.
Using too long delays like 5000 milliseconds unintentionally.
3fill in blank
hard

Fix the error in the code to correctly delay the request by 3 seconds in Postman.

Postman
setTimeout(() => pm.sendRequest(request, (err, res) => { console.log(res); }), [1]);
Drag options to blanks, or click blank then click option'
A3
B300
C3000
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using seconds directly instead of milliseconds.
Using 300 which is only 0.3 seconds.
4fill in blank
hard

Fill both blanks to create a function that delays a request by a given number of seconds in Postman.

Postman
function delayRequest(seconds) { setTimeout(() => pm.sendRequest(request, (err, res) => { console.log(res); }), [1] * [2]); }
Drag options to blanks, or click blank then click option'
A1000
Bseconds
Cms
Ddelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variables like ms or delay.
Not multiplying seconds by 1000.
5fill in blank
hard

Fill all three blanks to create a reusable delay function and use it to delay a request by 5 seconds in Postman.

Postman
function [1](s) { return new Promise(resolve => setTimeout(resolve, s * [2])); }

async function sendDelayedRequest() {
  await [3](5);
  pm.sendRequest(request, (err, res) => { console.log(res); });
}
Drag options to blanks, or click blank then click option'
Adelay
B1000
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Not using async/await correctly.
Using incorrect function names or missing multiplication by 1000.