DEV Community


Posted on • Originally published at requestly.Medium on

Simulate Different API status code using Requestly

This article explains how to use Requestly to simulate different API status codes and test your app.

Requestly Browser Extension can simulate different status codes on an API by redirecting the actual API to a mock API.

The mock API simulating the desired status code is hit instead of the actual API. It is done using the redirect rule of requestly.

Create a mock API using Requestly

Requestly has a Mock Server capability to create a Mock API response.

Requestly mock server handles the CORS headers automatically so that the browser does not block the cross-origin requests.

Redirecting the actual API endpoint to the Mock Server endpoint.

Redirect Blinkit Search API to a mock API simulating 404 status code

Removing Content-Security-Policy Headers

Sometimes redirection to mock API won’t work due to Content-Security-Policy- connect-src directive, which restricts the URLs loaded using script interfaces.

You can use the Requestly marketplace rule to bypass this, which is a prebuilt rule to remove the content-security-policy header.

Requestly Marketplace

I hope this empowers you to do robust testing of your frontend by simulating different API behaviours.

Further Resources:

This feature will soon be available on the desktop app. Stay Tuned.

Happy Debugging!

By @nafees87n

Originally published at

Top comments (0)