Skip to content

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-type contains the keyword json)
  • JSONP (response content-type is null or contains the keywords html/javascript)

Rule Syntax

txt
pattern resMerge://value [filters...]
ParametersDescriptionDetailed Documentation
patternExpression to match against the request URLMatch Pattern Documentation
valueOperation data object. Supports retrieval from the following sources:
• Directory/File Path
• Remote URL
• Inline/Embedded/Values content
Operation Instruction Documentation
filtersOptional 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.json

Note: 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://enableBigData

Once enabled, resMerge will attempt to process larger response volumes. Please note that this may increase memory consumption and processing time.

  1. Inject content before the response content (Prepend To Body): resPrepend
  2. Inject HTML content before the response content (Prepend HTML To Body, response type must be text/html): htmlPrepend
  3. Inject CSS content before the response content (Prepend CSS To Body, response type must be text/html or text/css): cssPrepend
  4. Inject JS content before the response content (Prepend JS To Body, response type must be text/html, text/css, or application/javascript): jsPrepend
  5. Replace the response content (Replace Body): resBody
  6. Replace the response content with HTML content (Replace Body, response type must be text/html): htmlBody
  7. Replace the response content with CSS content (Replace Body, response type must be text/html or text/css): cssBody
  8. Replace the response content with JS content (Replace Body, response type must be text/html, text/css, or application/javascript): jsBody
  9. Append content after the response content (Append To Body): resAppend
  10. Append HTML content after the response content (Append HTML To Body, response type must be text/html): htmlAppend
  11. Append CSS content after the response content (Append CSS To Body, response type must be text/html or text/css): cssAppend
  12. Append JS content after the response content (Append JS To Body, response type must be text/html, text/css, or application/javascript): jsAppend
  13. Replace the response content using keywords or regular expressions (Modify Body Text): resReplace
  14. Override JSON/Form objects in the response content (Modify Form/JSON): resMerge
  15. Delete a property from a JSON/Form object in the response content (Delete Form/JSON): delete://resBody.xxx