Skip to content
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: support hook response body for ext-plugin #6968

Merged
merged 23 commits into from
May 10, 2022

Conversation

soulbird
Copy link
Contributor

@soulbird soulbird commented Apr 29, 2022

Description

support hook response body for ext-plugin

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@soulbird soulbird marked this pull request as ready for review April 29, 2022 09:56
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
conf/config-default.yaml Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin/init.lua Outdated Show resolved Hide resolved
t/plugin/ext-plugin/response_body.t Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin/init.lua Show resolved Hide resolved
apisix/init.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
t/plugin/ext-plugin/response_body.t Outdated Show resolved Hide resolved
t/plugin/ext-plugin/response_body.t Outdated Show resolved Hide resolved
@soulbird soulbird requested a review from spacewander May 7, 2022 02:11
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
function _M.before_proxy(conf, ctx)
local http_obj = get_http_obj(ctx)
local res, err = get_response(ctx, http_obj)
if not res or err then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 100 has judgment that res is nil?

apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
apisix/plugins/ext-plugin/init.lua Outdated Show resolved Hide resolved

if code == 0 then
-- runner change body only, we should set code.
code = body and res.status or nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look like it's covered in ngx.status = code or res.status?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @soulbird

apisix/plugins/ext-plugin-post-resp.lua Outdated Show resolved Hide resolved
t/plugin/ext-plugin/response.t Show resolved Hide resolved
@spacewander spacewander merged commit c32caf3 into apache:master May 10, 2022
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants