Skip to content

Instantly share code, notes, and snippets.

@gszr
Last active July 25, 2025 13:37
Show Gist options
  • Save gszr/65bd520311501dcfec0c2532f3c2d050 to your computer and use it in GitHub Desktop.
Save gszr/65bd520311501dcfec0c2532f3c2d050 to your computer and use it in GitHub Desktop.
callout with duplicated headers
{
"name": "request-callout",
"config": {
"callouts": [
{
"name": "echo",
"cache": {
"bypass": false
},
"depends_on": [],
"request": {
"url": "http://localhost:8080/anything",
"method": "GET",
"headers": {
"custom": {
"Content-Type": "application/application/json"
},
"forward": false
},
"body": {
"custom": {
"something": "foobar"
},
"forward": true
},
"by_lua": "local headers = kong.ctx.shared.callouts.echo.request.params.headers; headers['content-type'] = nil; headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; kong.log.inspect.on(); kong.log.inspect(kong.ctx.shared.callouts.echo.request.params.headers)"
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment