This feature is experimental and can be used only if you compile Tyk yourself own using
jq tag: go build --tags 'jq'jq command line JSON processor. For more details, see https://stedolan.github.io/jq/.
Now you can use the full power of its queries and transformations to transform requests, responses, headers and even context variables.
We have added two new plugins:
transform_jq- for request transforms.transform_jq_response- for response transforms
{ "path": "<path>", "method": "<method>", "filter": "<content>" }
Request Transforms
Inside a request transform you can use following variables:.body- your current request body._tyk_context- Tyk context variables. You can use it to access request headers as well.
{ "body": <transformed-body>, "rewrite_headers": <set-or-add-headers>, "tyk_context": <set-or-add-context-vars> }.
body is required, while rewrite_headers and tyk_context are optional.
Response Transforms
Inside a response transform you can use following variables:.body- your current response body._tyk_context- Tyk context variables. You can use it to access request headers as well.._tyk_response_headers- Access to response headers
{ "body": <transformed-body>, "rewrite_headers": <set-or-add-headers>}.
body is required, while rewrite_headers is optional.