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

Conversation

tzssangglass
Copy link
Member

Signed-off-by: tzssangglass tzssangglass@gmail.com

What this PR does / why we need it:

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
@tzssangglass
Copy link
Member Author

I'm thinking that this implementation might not be good enough, because usually the user needs to not only read the request body, but also rewrite it.

@@ -169,6 +169,8 @@ function _M.go(case)
local entry = call_req:Args(1)
assert(entry:Name() == "x")
assert(entry:Value() == "z")
elseif case.get_request_body then
assert(call_req:Method() == a6_method.POST)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to check the request_body's value?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to validate different content-type, so the value of request body is not fixed.

Copy link
Member Author

Choose a reason for hiding this comment

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

actions.result would check the value in request body?

t/plugin/ext-plugin/request-body.t Show resolved Hide resolved
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
@tzssangglass
Copy link
Member Author

dealy to merge, is: https://github.com/api7/ext-plugin-proto/blob/main/lua/A6/ExtraInfo/ReqBody.lua used for request body?

@tzssangglass
Copy link
Member Author

dealy to merge, is: api7/ext-plugin-proto@main/lua/A6/ExtraInfo/ReqBody.lua used for request body?

ok, after review:https://lists.apache.org/thread/m5g44gtywx05x4s262rn7qg87oxscy0v, the ReqBody in ExtraInfo is used to holds the request body.

@tzssangglass
Copy link
Member Author

I will update this PR.

Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
Signed-off-by: tzssangglass <tzssangglass@gmail.com>
@spacewander spacewander merged commit e7ceda0 into apache:master Nov 29, 2021
@tzssangglass tzssangglass deleted the ext_rb branch November 29, 2021 06:37
besich pushed a commit to besich/apisix that referenced this pull request Dec 1, 2021
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.

None yet

3 participants