This repository contains a very simple Kong request transformer with some added functionality
example:
{
"name": "kong-plugin-custom-request-transformer",
"config": {
"add": {
"body":["meta.traceId:-header.Traceid-"]
}
}
}- this will copy the Traceid header field to a field named traceId inside the object field meta on added to the body, this support multiple nesting on the body, creating objects if required: syntax root.child.grandchild.< any nesting level >.targetfield on the left side of the :
example:
{
"name": "kong-plugin-custom-request-transformer",
"config": {
"wrap": {
"body": "data"
},
"add": {
"body": [
"meta.traceId:-header.Traceid-"
]
},
"remove":{
"headers":["Traceid"]
}
}
}- this will wrap the original body inside a field called data: resulting in something like this:
{
"data": {
"email": "[email protected]",
"name": "kong wrap"
},
"meta": {
"traceId": "req-3640c624-7e38-4ede-9800-11ae9fd0f9f4"
}
}This template was designed to work with the kong-vagrant
development environment. Please
check out that repo's README for usage instructions.