-
Notifications
You must be signed in to change notification settings - Fork 67
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
request help: edit request body #127
Comments
Not yet supported |
........ |
i want change request body |
我试着修改了几个文件,发现可以修改request body值了,先发你先参考看看 apisix-core-with-plugin/internal/http/request.go中
2.在(r *Request) FetchChanges(id uint32, builder *flatbuffers.Builder)中把
改为
3.在(r *Request) FetchChanges(id uint32, builder *flatbuffers.Builder)中在
后加入
4.在(r *Request) FetchChanges(id uint32, builder *flatbuffers.Builder)中把
改为
5.在(r *Request) FetchChanges(id uint32, builder *flatbuffers.Builder)中在
后加入
6.在apisix-core-with-plugin/pkg/http/http.go中的Request interface加入 在使用时使用r.SetBody([]byte("mytestbody"))并且在apisix的3.6.0版本下使用就可以了,我只是试用成功了,没测试是否还有其他问题 |
I've started a pull request: #151
|
the setBody([]byte) works fine when using only "ext-plugin-pre-req" once using both "ext-plugin-pre-req" and "ext-plugin-post-resp", it doesn't work. |
the the issue I faced related to the content-length header, as after setting the new body APISIX seems to send the original content-length to the upstream services when using both "ext-plugin-pre-req" and "ext-plugin-post-resp", and that leads to issues related to body parsing in some of these services (express app in my case). The issue get fixed by deleting the 'content-length' header after setting the new body so it get calculated again to the new length. |
Issue description
Does the golang plugin support modifying the request body?
Environment
uname -a
):The text was updated successfully, but these errors were encountered: