I am under the impression that KrakenD Body manipulation and generation (https://www.krakend.io/docs/enterprise/backends/body-generator/) of the body to the new request. Basically
the body generator modifier allows you to craft the body you send to a backend through templates, and enables injecting other values from the user request such as the original body, headers, querystrings or URL parameters.
I am creating a configuration file that defines:
{
"$schema": "https://www.krakend.io/schema/v3.json",
"version": 3,
"debug_endpoint": true,
"endpoints": [
{
"endpoint": "/bodygenerator/{id}",
"method": "GET",
"input_headers": [ "Content-Type" ],
"backend": [
{
"url_pattern": "/anything/{id}",
"method": "POST",
"encoding": "json",
"extra_config": {
"modifier/body-generator": {
"path": "./body.json.tmpl",
"content_type": "application/json",
"debug": true
}
},
"host": [ "http://httpbin.org/" ]
}
]
}
],
"port": 8010
}
with the template being
{
"id": "{{ .req_params.Id }}",
"message": "User said {{ .req_body.text }}"
}
I would expect, that upon calling http://krakenUrL/bodygenerator/someID the result to be as in the template when I call the API Gateway created by KrakenD, but I am getting a forwarder from the get, to a POST but without a body:
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept-Encoding": "gzip",
"Content-Length": "0",
"Host": "httpbin.org",
"User-Agent": "KrakenD Version 2.2.1",
"X-Amzn-Trace-Id": "Root=1-6422d748-3e1c5def04f1fb5b56794eab",
"X-Forwarded-Host": "api.pxou.com:8010"
},
"json": null,
"method": "POST",
"origin": "******",
"url": "http://krakenD:8010/anything/100"
}
Tested with
Apparently this feature is not available in the Community Edition (https://www.krakend.io/features/).