Understanding Modify Request body Rule
The Modify Request Body Rule in Requestly allows users to tweak the data sent in the request body before it’s sent to the server. This feature is crucial for developers and testers, giving them the power to simulate different situations, troubleshoot problems, and refine their web applications without having to directly change the main code.
Content Overview
Video Guide
Step-by-Step Guide
To fully utilize the feature, let’s walk through the setup process:
- Setup: Start by installing Requestly extension in your browser and navigate to the Rules section.
- Creating a Rule: Select the Modify Request Body option and define the conditions under which the rule should be applied.
- Specify Modification: Choose how you want to modify the request body. static and programmatic.
- Define Text: Enter the necessary text details based on your chosen modification method.
- Save and Apply: Save the rule and ensure it’s applied, then proceed to test your modifications on the target webpage.
Options
Below are details related to each option present on the Insert Script Rule Screen:
- Source Condition: This condition helps identify the HTTP requests to which the rule should be applied. Users can specify conditions based on URL, Hostname, or Path using matching criteria such as Contains, Equals, Regex match, or Wildcard Match.
- Source Filters: Further refine the Source Condition using Source Filters, accessible via the filter icon next to the Source Condition field.
- Modify Request Body: Define how you want to modify the request body. Options include static and programmatic.
Use Cases
The Modify Request Body Rule offers a multitude of applications. Here are some scenarios where it proves particularly beneficial:
Testing Form Submissions
During development or testing phases, users can simulate various form submissions by modifying the request body. This enables thorough testing of form validation, error handling, and data processing mechanisms.
To simulate form submissions:
- Create a new
Modify Request Body
rule . Filter
the form submission request you intend to modify- Adjust the request body to mimic various scenarios, such as different
user inputs
- Submit the modified form requests.
Verify
the behaviour of form validation, error handling, and data processing to ensure they meet the desired requirements
Debugging API Calls
Troubleshooting issues with API calls becomes more efficient with the ability to tweak the request body on-the-fly. Developers can quickly identify and rectify issues without altering the application’s codebase.
To debug API calls:
- Create a new
Modify Request Body
rule. Filter
the API call that needs debugging- Adjust the
payloads
as necessary to reproduce the issue. - Submit the modified API request.
- Observe the response and debug any errors or unexpected behaviour encountered
Security Testing
By altering request parameters or payloads, security professionals can evaluate an application’s resilience to common vulnerabilities such as SQL injection or Cross-Site Scripting (XSS).
To conduct security testing:
- Create a new
Modify Request Body
rule. - Identify the endpoints or functionalities susceptible to security vulnerabilities.
- Inject malicious payloads to test for vulnerabilities like
SQL injection or XSS
. - Submit the modified requests and observe the application’s response.
- Analyze how the application handles the modified requests and assess its resilience against security threats.
Troubleshooting
There are some cases where rules might not work as expected, visit our troubleshooting guide for more details.