Skip to main content
Simulate a failed response on the first request and a successful one on subsequent attempts using shared state in Requestly Interceptor.
$sharedState is only available in extension versions > v24.8.13 and desktop app versions > v1.7.1.

Steps to conditionally fail requests are:

1

Create a Modify Response Rule

Open Requestly Interceptor and create a new Modify Response rule.
2

Enable Dynamic JavaScript Modification

Choose the Dynamic JavaScript option to write custom logic for the response.
3

Add JavaScript to Control Response Based on Request Count

Use the following code to fail the first request and let others succeed: