Let's assume we have an HTTP/HTTPS traffic hitting an endpoint via GET request. The endpoint then returns a response. Is there a mechanism to delay the response for X seconds(assuming X < request timeout)? I have tried using BREAKPOINT already intuitively and was wondering if there is a direct solution for this.
There are two solutions:
Right-Click on the request you'd like to delay -> Tools -> Network Condition -> Create a rule with the 3G profile.
function onResponse(context, url, request, response) {
console.log("Start sleep");
// Sleep 5 seconds
sleep(5000);
// Done
return response;
}