Delay Network Requests

Learn how to configure HTTP rules to simulate network latency for testing slow connections


The Delay Network Request rule in Requestly enables you to simulate network latency on HTTP requests for testing and debugging purposes. By adding delays, you can observe how your application behaves under slow network conditions.

Why Use the Delay Network Requests?

  • Test Slow Network Scenarios: Understand how your application handles slow connections, especially for users in remote areas.

  • Test API Latency: Evaluate how your app behaves when one or more APIs respond slowly, ensuring appropriate error handling and fallback mechanisms.

  • Identify Race Conditions: Check if any race conditions exist when resource X gets loaded before or after resource Y.

  • UI/UX Testing: Verify if the user interface provides appropriate feedback (like loaders or error messages) during delays.

How to Configure the Rule

1

Open HTTP Rules and Create a New Rule

Navigate to the HTTP Rules tab in the web or desktop app. Click on + New Rule and select Delay Network Requests from the options.

2

Name and Describe Your Rule

Provide a descriptive name for the rule to keep your setup organized. Optionally, add a brief description explaining its purpose for easier identification later.

3

Define the Source Condition

Define where the rule should be applied by specifying criteria such as URL, Host, or Path. You can choose from options like Regex, Contains, Wildcard, or Equals, or use a Filter for more precise conditions.

For more details on source conditions, read this guide

Example:

To apply a rule to an API fetching product data on our playground website, use the following configuration:

  • Condition Type: URL

  • Operator: Contains

  • Value: mock.redq.io/api/products

This example targets the product data API of our playground website, https://www.requestly-playground.com/.

You can also import this rule and apply it directly by using this shared list.

4

Set the Request Delay

Specify the delay duration in milliseconds. For example, enter 4000 to introduce a 4-second delay.

Delay Capping — In the browser extension, delays are capped to prevent performance issues. The maximum delay is 5000 ms for XHR/Fetch requests and 10000 ms for other resources (JS, CSS, images, etc.). The Desktop App has no such restrictions.

5

Save and Activate the Rule

Once you are satisfied with your configuration, click Save to store the rule. After saving, make sure to toggle the rule ON to activate it. This will apply the rule and ensure it works as expected.

6

Test the Rule

To ensure the rule is working correctly, click the Test button and enter the URL of the page where you want to apply this rule.

This will open the webpage in a new tab, with a widget showing the status of applier rules.

Here, You can see the requests are delayed, as the Queued At/Started At time in the Network tab goes up by 4 seconds (4000 ms).

Updated on