- 
When the content type of the request is JSON, but the body cannot be parsed as such. 
This filter allows changes to the request/response body based on a path regex and content type.
Changes take the form of JSON Patches as defined in RFC 6902.
Name: body-patcher
Default Configuration: body-patcher.cfg.xml
Released: v8.0.0.0
Bundle: repose-filter-bundle
This filter has no hard dependency on any other filter.
However, the API Validator filter can be used to validate the request body before attempting to apply patches.
| Status Code | Reasons | 
|---|---|
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
This configuration will apply a set of patches to HTTP messages for various resources. In doing so, it will demonstrate all of the functions of this filter.
<body-patcher xmlns="http://docs.openrepose.org/repose/bodypatcher/v1.0">
    <change> (1)
        <request> (2)
            <json> (3)
                [
                    {
                        "op" : "replace",
                        "path" : "/a",
                        "value" : 6
                    },{
                        "op" : "remove",
                        "path" : "/b"
                    }
                ]
            </json>
        </request>
        <response> (4)
            <json> (5)
                [
                    {
                        "op" : "add",
                        "path" : "/d",
                        "value" : false
                    }
                ]
            </json>
        </response>
    </change>
    <change path="/foo/bar/.*"> (6)
        <response>
            <json>
                [
                    {
                        "op" : "remove",
                        "path" : "/b"
                    }
                ]
            </json>
        </response>
    </change>
</body-patcher>| 1 | Declares a change to be made. The absence of the path attribute indicates that this change applies to requests with any path. | 
| 2 | Contains the set of patches to be applied to the request.
This element is optional, but at least one of the requestorresponseelements must be present. | 
| 3 | The action to take for JSON content.
The content of this element should be a JSON patch.
In this case, the JSON patch will replace the value of the afield with6, and remove thebfield. | 
| 4 | Contains the set of patches to be applied to the response.
This element is optional, but at least one of the requestorresponseelements must be present. | 
| 5 | In this case, the JSON patch will add a dfield with a value offalse. | 
| 6 | Declares a change to be made, but only to requests with a path matching the regular expression /foo/bar/.*. |