-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ext-plugin-post-resp): support get response body by extra_info #7947
Conversation
t/plugin/ext-plugin/extra-info.t
Outdated
|
||
|
||
|
||
=== TEST 10: ask request body (not exist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we check request body here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reused the handle_extra_info function to get the response body, the request body is part of this function.
LGTM |
|
||
|
||
|
||
=== TEST 5: ask response body (not exist) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a test with empty response body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make sense to add a test with an empty response body in the ext-plugin-pre-req
plugin. I guess you want me to add this test case in the ext-plugin-post-resp
plugin.
However, an empty response body usually occurs when the upstream returns a 304 status code or the request method is HEAD, which needs to be handled separately in subsequent PRs. I have added TODO
.
apisix/plugins/ext-plugin/helper.lua
Outdated
|
||
repeat | ||
local chunk, read_err, cb_err | ||
-- TODO: HEAD or 304 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use at least one sentence for this TODO? I can't recall why this comment is added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…pache#7947) Co-authored-by: soulbird <zhaothree@gmail.com>
Description
Provide the
ext-plugin-post-resp
plugin with the ability to get the response body, so that the External Plugin will be able to do some processing on the response body.As an additional feature, the
ext-plugin-post-resp
plugin also supports getting the request context in the response phase.Fixes #7575
Checklist