Getting Started
API Client
Inspect Traffic
HTTP Rules (Modify Traffic)
Redirect URL (Map Local, Map Remote)
Replace Strings (Switch Hosts, API Endpoints)
Modifying the request payload is the process of changing the data sent to the server when making an HTTP request. You can use Modify Request Body rule to override the API request body with static data or programmatically modify the existing request payload.
In this mode, you can enter a static request body (JSON) you want to forward to the server.

Rule working but doesn't show updated request body in devtools
Request Body Modifications will not show up in the browser network devtools due to technical constraints. So your rule might actually be working but only doesn't show the updated Request body in the browser devtools.
URL, Host, or Path with Regex, Contains, Wildcard, or Equals to match the source request. Learn more about source conditions here.The existing request body can be modified programmatically using JavaScript.

Programmatic Modification Script (JS) is where you write a JavaScript script that can modify the existing request body programmatically.
modifyRequestBodymethod (string)- The HTTP method of the request. GET | POST | PUT | DELETE etc.url (string) - The request URL.body (string)- The original request body stringified:'{"app":"requestly","feature":"modify-request"}'
bodyAsJson (JSON object)- The original request body parsed into JSON object:{
"app":"requestly",
"feature":"modify-request"
}
Return type of modifyRequestBodyYou can return modified body as string or JSON object.
We use https://echo.hoppscotch.io/ to test this which echoes back the request.
POST request.const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app":"requestly"}'
};
fetch('<https://echo.hoppscotch.io/>', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Modify Request Body rule uses the following JavaScript. You can find the rule here.function modifyRequestBody(args) {
const { method, url, body, bodyAsJson } = args;
// Change request body below depending upon request attributes received in args
let newBody;
if (method === "POST") {
newBody = bodyAsJson;
newBody["feature"] = "modify request";
}
return newBody;
}
feature being added to the request body when hoppscotch echoes back the request.