resMerge
Intelligently merges specified data objects into the response body, suitable for modifying partial parameters without affecting the remaining content. Supports the following response types:
- JSON (response
content-typecontains the keywordjson) - JSONP (response
content-typeis null or contains the keywordshtml/javascript)
Rule Syntax
txt
pattern resMerge://value [filters...]| Parameters | Description | Detailed Documentation |
|---|---|---|
| pattern | Expression to match against the request URL | Match Pattern Documentation |
| value | Operation data object. Supports retrieval from the following sources: • Directory/File Path • Remote URL • Inline/Embedded/Values content | Operation Instruction Documentation |
| filters | Optional filters. Supports matching against: • Request URL/Method/Header/Content • Response Status Code/Headers | Filter Documentation |
Configuration Example
Inline Method
txt
www.example.com/path resMerge://test=123 file://({"name":"avenwu"})Visiting https://www.example.com/path/to, the browser receives the following:
js
{"name":"avenwu","test":"123"}Inline Method
txt
``` resMerge.json
a.b.c: 123
c\.d\.e: abc
```
www.example.com/path resMerge://{resMerge.json} file://({"name":"avenwu"})Visiting https://www.example.com/path/to Content received by the browser:
js
{"name":"avenwu","a":{"b":{"c":123}},"c.d.e":"abc"}Local/Remote Resources
txt
www.example.com/path1 resMerge:///User/xxx/test.json
www.example.com/path2 resMerge://https://www.xxx.com/xxx/params.json
# Editing a temporary file
www.example.com/path3 resMerge://temp/blank.jsonNote: Response Size Limit
To ensure processing performance, resMerge enforces a default size limit for response content.
- Limit Specification: The automatic merge processing is only applied to responses with a body size less than 2MB. Responses exceeding this size will be skipped.
- How to Override: If you need to handle larger responses (e.g., for downloading files or processing large data interfaces), you can explicitly enable this capability by adding the following directive to your matching rule:
txt
pattern enable://resMergeBigData
# or
www.example.com/path1 resMerge:///User/xxx/test.json lineProps://enableBigDataOnce enabled, resMerge will attempt to process larger response volumes. Please note that this may increase memory consumption and processing time.
Associated Protocols
- Inject content before the response content (
Prepend To Body): resPrepend - Inject HTML content before the response content (
Prepend HTML To Body, response type must betext/html): htmlPrepend - Inject CSS content before the response content (
Prepend CSS To Body, response type must betext/htmlortext/css): cssPrepend - Inject JS content before the response content (
Prepend JS To Body, response type must betext/html,text/css, orapplication/javascript): jsPrepend - Replace the response content (
Replace Body): resBody - Replace the response content with HTML content (
Replace Body, response type must betext/html): htmlBody - Replace the response content with CSS content (
Replace Body, response type must betext/htmlortext/css): cssBody - Replace the response content with JS content (
Replace Body, response type must betext/html,text/css, orapplication/javascript): jsBody - Append content after the response content (
Append To Body): resAppend - Append HTML content after the response content (
Append HTML To Body, response type must betext/html): htmlAppend - Append CSS content after the response content (
Append CSS To Body, response type must betext/htmlortext/css): cssAppend - Append JS content after the response content (
Append JS To Body, response type must betext/html,text/css, orapplication/javascript): jsAppend - Replace the response content using keywords or regular expressions (
Modify Body Text): resReplace - Override JSON/Form objects in the response content (
Modify Form/JSON): resMerge - Delete a property from a JSON/Form object in the response content (
Delete Form/JSON): delete://resBody.xxx