-
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: make it support rewrite request body in external plugins #9864
Conversation
This PR is based on api7/ext-plugin-proto#35, maybe we should wait for the PR to merge and then update the dependency version of |
apisix/plugins/ext-plugin/init.lua
Outdated
local len = rewrite:BodyLength() | ||
if len > 0 then | ||
let body = rewrite:BodyAsString() | ||
ngx.req.set_body_data(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.
ngx.req.set_body_data(body) | |
ngx.req.read_body() | |
ngx.req.set_body_data(body) |
We need call ngx.req.read_body()
before set_body_data
Before this line, we can mock
And then, we can add test cases in
|
We aslo should update the documents. |
Description
make it support rewrite request body.
please update ext-plugin-proto first.
to make it be able to rewrite the request body in external plugins.
i don't have a full development environment for apisix. someone have the full development env can help to add the test code.
Fixes # (issue)
Checklist