Skip to content

Instantly share code, notes, and snippets.

@gszr
Last active March 12, 2025 19:07
Show Gist options
  • Save gszr/e313f0242cdf8bd976d1c88bdc9bb70c to your computer and use it in GitHub Desktop.
Save gszr/e313f0242cdf8bd976d1c88bdc9bb70c to your computer and use it in GitHub Desktop.
{
"name": "request-callout",
"config": {
"callouts": [
{
"name": "callout1",
"request": {
"url": "http://httpbin.org/anything",
"by_lua": "local body = kong.request.get_body() or {}; local id = body.id; if id then kong.ctx.shared.callouts.callout1.request.params.url = 'http://httpbin.org/anything/' .. id end",
"method": "GET"
},
"response": {
"body": {
"decode": true
}
}
}
],
"upstream": {
"body": {
"forward": false,
"custom": {
"id": "$(callouts.callout1.response.body.url)"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment