-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect #6300
fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect #6300
Conversation
@liangliang4ward Better to add some test cases to cover it. |
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.
The fix LGTM.
You can learn how to write tests via https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md and the current test
apisix/t/plugin/proxy-rewrite3.t
Lines 87 to 129 in ebe91aa
=== TEST 3: set route(update rewrite method) | |
--- config | |
location /t { | |
content_by_lua_block { | |
local t = require("lib.test_admin").test | |
local code, body = t('/apisix/admin/routes/1', | |
ngx.HTTP_PUT, | |
[[{ | |
"methods": ["GET"], | |
"plugins": { | |
"proxy-rewrite": { | |
"uri": "/plugin_proxy_rewrite", | |
"method": "GET", | |
"scheme": "http", | |
"host": "apisix.iresty.com" | |
} | |
}, | |
"upstream": { | |
"nodes": { | |
"127.0.0.1:1980": 1 | |
}, | |
"type": "roundrobin" | |
}, | |
"uri": "/hello" | |
}]] | |
) | |
if code >= 300 then | |
ngx.status = code | |
end | |
ngx.say(body) | |
} | |
} | |
--- response_body | |
passed | |
=== TEST 4: hit route(upstream uri: should be /hello) | |
--- request | |
GET /hello | |
--- grep_error_log_out | |
plugin_proxy_rewrite get method: GET |
in proxy-rewrite3.t ,I thought the |
Let's add a test to prove your suspect. The test is passed in the CI. |
this PR will to solve this issue; |
add a test case |
Merged. Thanks! |
What this PR does / why we need it:
when conf.headers are missing,conf.method can make effect
Pre-submission checklist: