shreemaan-abhishek commented on issue #10894: URL: https://github.com/apache/apisix/issues/10894#issuecomment-1921539599
it's gonna be a long process so either you can use serverless plugin to get the body and then parse it to a lua table then modify it as you want followed by setting the modified body as the response or put this logic in a new plugin. Here is an example to get you started: ```shell curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "uri": "/get", "plugins": { "serverless-post-function": { "phase": "body_filter", "functions": [ "return function (conf, ctx) local core = require(\"apisix.core\") local body = core.response.hold_body_chunk(ctx) -- local new_body = transform(body) ngx.arg[1] = \"set new body here\" ngx.arg[2] = true end"] } }, "upstream": { "nodes": { "httpbin.org:80": 1 }, "type": "roundrobin" } } ' ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
