docs/en/docs/rules/htmlBody.md
Replaces the existing response body with the specified content. (This only works for responses with content-type containing html and a status code containing a body (e.g., 200/500).)
⚠️ Note: Requests without a body, such as 204 and 304 responses, are not affected.
pattern htmlBody://value [filters...]
| Parameters | Description | Detailed Documentation |
|---|---|---|
| pattern | An expression to match against the request URL | Match Pattern Documentation |
| value | Text or binary content. The following types are supported: | |
| • Directory/File Path | ||
| • Remote URL | ||
| • Inline/Embedded/Values Content | Operation Instruction Documentation | |
| filters | Optional filters. Supports matching: | |
| • Request URL/Method/Headers/Content | ||
| • Response Status Code/Headers | Filter Documentation |
www.example.com/path htmlBody://(Hello) file://(-test-)
www.example.com/path2 htmlBody://(Hello) file://(-test-) resType://js
https://www.example.com/path/to results in a response of Hellohttps://www.example.com/path2/to results in a response of -test-``` body.txt
Hello world.
```
www.example.com/path htmlBody://{body.txt} file://(-test-)
www.example.com/path2 htmlBody://{body.txt} file://(-test-) resType://css
https://www.example.com/path/to results in a response of Hello world.https://www.example.com/path2/to results in a response of -test-When the API response type (Content-Type) is not standardized and returned as text/html, this may result in:
Use enable://strictHtml or enable://safeHtml mode to protect non-HTML content:
www.example.com/path1 htmlBody://(test) file://(-test-) enable://strictHtml
www.example.com/path2 htmlBody://(test) file://([-test-]) enable://strictHtml
www.example.com/path3 htmlBody://(test) file://([-test-]) enable://safeHtml
www.example.com/path4 htmlBody://(test) file://(<div>Test</div>) enable://strictHtml
https://www.example.com/path1/to results in a response of -test-https://www.example.com/path2/to results in a response of [-test-]https://www.example.com/path3/to results in a response of [-test-]https://www.example.com/path4/to results in a response of testsafeHtml/strictHtml feature reference: enable://safeHtml, lineProps://strictHtml
www.example.com/path1 htmlBody:///User/xxx/test.txt
www.example.com/path2 htmlBody://https://www.xxx.com/xxx/params.txt
# Editing a temporary file
www.example.com/path3 htmlBody://temp/blank.txt