-
I am trying to implement a custom kong plugin that would encrypt the (proxied) service response before it returns it to the client and decrypt the request body before it passes it to the proxied service. To do so I am trying to fetch the request body and the response body and set it as a new header value for testing purposes. I am unable to fetch them though. I get Could you please guide me on how to access the request body and service.response.body in the lua handler code? Thanks My lua handler code is as follows
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @shahamit, The following links provide a rough overview of the request and the how to operate on the entire response body:
If you want to perform a response transform that the stock response transformer can't do you can follow the "aggregate each of the body_filter iterations into a table, concatenate them, and then pass into your transform function when you get an EOF" pattern from above (and probably even reuse a fair amount of the code). You'll write your own function where response-transformer otherwise uses |
Beta Was this translation helpful? Give feedback.
Hi @shahamit,
The following links provide a rough overview of the request and the how to operate on the entire response body:
If you want to perform a response transform that the stock response transformer can't do you can follow the "aggregate each of the body_filter iterations into a table, concatenate them, and then pass into your transform function when you get an EOF" pattern from above (and probably even reuse a fair amount of the code). You'll write your own function where response-transforme…