I’m migrating to version 0.14.1 and thus also trying to use the PDK for my custom plugins. I’m a bit confused when looking at the exit path (in the access phase only) of the plugins bundled in Kong as:
When applicable, they have adopted the new “delayed response” pattern (e.g. AWS Lambda plugin and Request Termination plugin), but they are not yet using the Kong PDK
My understanding is that, for my nominal use cases (in case everything goes fine in my plugin ), instead of duplicating the code found in AWS Lambda and Request Termination plugins (aka the
send methods), I can directly use the
kong.response.exit PDK function, and everything is done in a single line of code for me: great!
However, what about the error cases of my plugin, where I used to call the legacy/non-public
kong.tools.responses.send_HTTP_* function ? I don’t see any of the bundled plugins replacing such calls with the “delayed response” pattern (i.e. they are still using the
kong.tools.responses.send_HTTP_* function) => is there any reason for that?
Should I stay with this non-public function or should I use
kong.response.exit function for error cases as well ?
Thanks for your help !