Skip to content

feat(ext-plugin): support to get request body#5600

Merged
spacewander merged 6 commits into
apache:masterfrom
tzssangglass:ext_rb
Nov 29, 2021
Merged

feat(ext-plugin): support to get request body#5600
spacewander merged 6 commits into
apache:masterfrom
tzssangglass:ext_rb

Conversation

@tzssangglass

Copy link
Copy Markdown
Member

Signed-off-by: tzssangglass [email protected]

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

@tzssangglass

Copy link
Copy Markdown
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.

Comment thread t/lib/ext-plugin.lua
assert(entry:Name() == "x")
assert(entry:Value() == "z")
elseif case.get_request_body then
assert(call_req:Method() == a6_method.POST)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

Comment thread t/plugin/ext-plugin/request-body.t
Signed-off-by: tzssangglass <[email protected]>
@tzssangglass

Copy link
Copy Markdown
Member Author

@tzssangglass

Copy link
Copy Markdown
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
Copy Markdown
Member Author

I will update this PR.

Comment thread apisix/plugins/ext-plugin/init.lua Outdated
Signed-off-by: tzssangglass <[email protected]>
Comment thread apisix/plugins/ext-plugin/init.lua Outdated
Signed-off-by: tzssangglass <[email protected]>
@spacewander
spacewander merged commit e7ceda0 into apache:master Nov 29, 2021
@tzssangglass
tzssangglass deleted the ext_rb branch November 29, 2021 06:37
bd1dtn pushed a commit to bd1dtn/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.

3 participants