htmlAppend
Appends the specified content after the existing response body. (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.
Rule Syntax
txt
pattern htmlAppend://value [filters...]
Parameters | Description | Detailed Documentation |
---|---|---|
pattern | An expression to match against the request URL | Match Pattern Documentation |
value | Text or binary content. Supports the following types: • 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 |
Configuration Example
Inline Method
txt
www.example.com/path htmlAppend://(Hello) file://(-test-)
www.example.com/path2 htmlAppend://(Hello) file://(-test-) resType://js
- Requesting
https://www.example.com/path/to
results in a response of-test-Hello
- Requesting
https://www.example.com/path2/to
results in a response of-test-
Inline/Values Method
txt
``` body.txt
Hello world.
```
www.example.com/path htmlAppend://{body.txt} file://(-test-)
www.example.com/path2 htmlAppend://{body.txt} file://(-test-) resType://css
- Requesting
https://www.example.com/path/to
results in a response of-test-Hello world.
- Requesting
https://www.example.com/path2/to
results in a response of-test-
Avoiding Non-Standard Requests
When the API response type (Content-Type) is not standardized and returned as text/html
, this may result in:
- The front-end mistakenly parsing the API data as HTML
- Injected content corrupts the original data structure
- Triggering front-end parsing errors
Use enable://strictHtml
or enable://safeHtml
mode to protect non-HTML content:
txt
www.example.com/path1 htmlAppend://(test) file://(-test-) enable://strictHtml
www.example.com/path2 htmlAppend://(test) file://([-test-]) enable://strictHtml
www.example.com/path3 htmlAppend://(test) file://([-test-]) enable://safeHtml
www.example.com/path4 htmlAppend://(test) file://(<div>Test</div>) enable://strictHtml
- Requesting
https://www.example.com/path1/to
results in a response of-test-
- Requesting
https://www.example.com/path2/to
results in a response of[-test-]
- Requesting
https://www.example.com/path3/to
results in a response of[-test-]
- Requesting
https://www.example.com/path4/to
results in a response of<div>Test</div>test
safeHtml
/strictHtml
Function reference: enable://safeHtml, lineProps://strictHtml
Local/Remote Resources
txt
www.example.com/path1 htmlAppend:///User/xxx/test.txt
www.example.com/path2 htmlAppend://https://www.xxx.com/xxx/params.txt
# Editing a temporary file
www.example.com/path3 htmlAppend://temp/blank.txt
Associated Protocols
- Inject content before the response: reqAppend
- Inject content before HTML-type response content: htmlPrepend
- Replace HTML-type response content: htmlBody
- Validate HTML Content format: enable://safeHtml, lineProps://strictHtml