Skip to main content

HTTP Message Body Rewrite

Message body rewriting allows users to modify the body of HTTP requests or responses that match specific URLs. This feature can be used to replace or modify specific text fragments. Below is a detailed explanation of each field:

FieldTypeRequiredDescription
matchstringYesUsed to match the URL
findstringYesRegular expression used to search the body
replacestringYesUsed to replace the found content (supports wildcard matching in regex)
typestringYesType (can be request or response)
body_rewrites:
- match: "http://www\\.egernapp\\.com/egern.html"
find: egern
replace: nrene
type: response

In the example above, the system will look for all response types where the URL matches "http://www.egernapp.com/egern.html". It will then search for "egern" in the message body and replace it with "nrene".

This feature can be useful in various scenarios, such as injecting data into the request body or modifying returned response data.