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(ext-plugin): support to get request body #5600

Merged
merged 6 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apisix/plugins/ext-plugin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ local function handle_extra_info(ctx, input)
local reqbody_req = extra_info_reqbody.New()
reqbody_req:Init(info.bytes, info.pos)

res = core.request.get_body()
local err
res, err = core.request.get_body()
if not res then
tzssangglass marked this conversation as resolved.
Show resolved Hide resolved
core.log.error("failed to read request body: ", err)
end

else
return nil, "unsupported info type: " .. info_type
end
Expand Down
2 changes: 2 additions & 0 deletions t/plugin/ext-plugin/request-body.t
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,5 @@ POST /hello
qr/send extra info req successfully/
--- grep_error_log_out
send extra info req successfully
--- error_log
failed to read request body: nil