-
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: add rewrite:RespHeaders
and modify the upstream response headers via request
implementation
#6426
Conversation
…ers via `request` implementation
need to update apisix/rockspec/apisix-master-0.rockspec Line 70 in 749094b
to 0.4.0 ref: https://github.com/api7/ext-plugin-proto/releases/tag/v0.4.0 |
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.
Let's add a test like:
apisix/t/plugin/ext-plugin/http-req-call.t
Line 210 in 80aaf7e
=== TEST 7: rewrite args |
You can prepare data for the mock runner in:
Line 323 in 80aaf7e
elseif case.rewrite_args == true or case.rewrite_args_only == true then |
You can refer to https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md for how to write/run test.
For example,
Check response headers.
--- response_headers
X-Resp: foo
X-Req: foo, bar
The test cases can't be run in both my two centos machines(follow the step in docs). So I have to try follow the exsisting cases and push code to ci to verify it.
|
OK Co-authored-by: 帅进超 <shuaijinchao@gmail.com>
fix: rename
|
@shuaijinchao |
`[root@iZbp1efn5vn52xspp2bid5Z apisix]# prove -I../test-nginx/lib -I./ -r -s t/plugin/ext-plugin/http-req-call.t Failed test 'TEST 7: rewrite args - status code ok'at /opt/service/test/apisix/../test-nginx/lib/Test/Nginx/Socket.pm line 948.got: '404'expected: '200'Failed test 'TEST 7: rewrite args - response_body - response is expected (repeated req 0, req 0)'at /opt/service/test/apisix/../test-nginx/lib/Test/Nginx/Socket.pm line 1589.@@ -1,3 +1 @@-uri: /plugin_proxy_rewrite_args+{"error_msg":"404 Route Not Found"}-a: foo,bar-c: bar`'TEST 7' also failed. Is there a problem with setting it?Please help me. |
@rampagecong OK, I need some time to check this question and get back to you later. |
Successfully! |
fix: Optimize the code
Hi @rampagecong , thank you for your contribution! Here is the Contributor T-shirt form[1], if you're interested, kindly take a look :) [1] https://github.com/apache/apisix/blob/master/CONTRIBUTING.md#contributor-t-shirt |
What this PR does / why we need it:
This PR add the ability to call upstream server when change the response header.
When we implement SSO, we can set and modify cookie in APISIX plugin layer and also call upstream at the same time.
This is refer to apache/apisix-go-plugin-runner#67
ext-plugin-proto : api7/ext-plugin-proto#26
apisix-go-plugin-runner : apache/apisix-go-plugin-runner#68
Pre-submission checklist: