In this article, we will explore how to change the response body of JS files using an open-source developer tool called Requestly.
- Testing new functionality directly on the production site
- Testing bug fixes before shipping code
- Modifying JS content and testing for security-related things on the app
Modifying JS Response body using the Desktop app
Firstly, to change the response body it’s recommended to download Requestly’s desktop app, which has the capability to modify the live HTML/CSS/JS scripts. If you prefer a lightweight approach, you can use the Requestly browser extension. The steps are explained later in the blog.
Let’s say you want to change the JS file used on Airbnb.com. In order to do that:
- Download and Install the Requestly desktop app.
- Open the app, and click Connect Apps.
- Choose the browser you want to launch.
- Search for airbnb.com and select the JS file you want to modify
- Right-click on the file and click Modify Response Body.
- Select HTML/CSS/JS in the pop-up and define the response body.
- Now save the rule by clicking Create Rule, and you will see the Airbnb website loading with your modified JS file.
Modifying JS file using Requestly browser extension:
If you wish to have a more lightweight approach, albeit not a straightforward one, you can install Requestly’s browser extension to modify the JS files of a website.