Body Transformer Configuration
Parameters
See plugin common configurations for configuration options available to all plugins.
-
request—object· optionalRequest body transformation configuration.
-
input_format—string· optionalValid values:
xml,json,encoded,args,plain, ormultipartRequest body original media type. If unspecified, the value would be determined by the
Content-Typeheader to apply the corresponding decoder.The
xmloption corresponds totext/xmlmedia type. Thejsonoption corresponds toapplication/jsonmedia type. Theencodedoption corresponds toapplication/x-www-form-urlencodedmedia type. Theargsoption corresponds to GET requests. Theplainoption corresponds totext/plainmedia type. Themultipartoption corresponds tomultipart/form-datamedia type.If the media type is not one of the supported types, the value would be left unset and the transformation template will be directly applied.
-
template—string· requiredRequest body transformation template. The template uses lua-resty-template syntax. See the template syntax for more details.
You can also use auxiliary functions
_escape_json()and_escape_xml()to escape special characters such as double quotes,_bodyto access request body, and_ctxto access context variables. See examples to learn more.The template names
_ctx,_body,_escape_json,_escape_xml, and_multipartare reserved;_escape_json()and_escape_xml()are called as functions. Decoded request fields with these names are ignored so that they cannot replace the helpers. -
template_is_base64—boolean· optionalSet to true if the template is base64 encoded.
-
-
response—object· optionalResponse body transformation configuration.
-
input_format—string· optionalValid values:
xml,json,encoded,args,plain, ormultipartResponse body original media type. If unspecified, the value would be determined by the
Content-Typeheader to apply the corresponding decoder.The
xmloption corresponds totext/xmlmedia type. Thejsonoption corresponds toapplication/jsonmedia type. Theencodedoption corresponds toapplication/x-www-form-urlencodedmedia type. Theargsoption is primarily used for request query arguments and is typically not applicable to response bodies. Theplainoption corresponds totext/plainmedia type. Themultipartoption corresponds tomultipart/form-datamedia type.If the media type is none of the supported types, the value would be left unset and the transformation template will be directly applied.
-
template—string· requiredResponse body transformation template.
The template names
_ctx,_body,_escape_json,_escape_xml, and_multipartare reserved;_escape_json()and_escape_xml()are called as functions. Decoded response fields with these names are ignored so that they cannot replace the helpers. -
template_is_base64—boolean· optionalSet to true if the template is base64 encoded.
-
-
max_req_body_size—integer· optional · default:67108864Valid values: greater than or equal to 1
Maximum request body size in bytes read for transformation. A larger body is rejected with status
413. Introduced in API7 Enterprise 3.9.17 and 3.10.4, and APISIX 3.18.0. -
max_resp_body_size—integer· optional · default:67108864Valid values: greater than or equal to 1
Maximum response body size in bytes buffered for transformation. A larger response is truncated to this size before transformation. The chunk that crosses the threshold is buffered before the limit is enforced, so transient memory use can exceed the configured size. Introduced in API7 Enterprise 3.9.17 and 3.10.4, and APISIX 3.18.0.