You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/02/14 07:23:10 UTC
[GitHub] [apisix] liangliang4ward opened a new pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
liangliang4ward opened a new pull request #6300:
URL: https://github.com/apache/apisix/pull/6300
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
when conf.headers are missing,conf.method can make effect
<!--- If it fixes an open issue, please link to the issue here. -->
### Pre-submission checklist:
<!--
Please follow the PR manners:
1. Use Draft if the PR is not ready to be reviewed
2. Test is required for the feat/fix PR, unless you have a good reason
3. Doc is required for the feat PR
4. Use a new commit to resolve review instead of `push -f`
5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
6. Use "request review" to notify the reviewer once you have resolved the review
7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
-->
* [x] 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?
* [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward removed a comment on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward removed a comment on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038740595
> > > 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](https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md?rgh-link-date=2022-02-14T01%3A06%3A06Z) and the current test
> > > https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
> >
> >
> > in proxy-rewrite3.t ,I thought the `TEST 2` case according to the original code, it should not succeed。
>
> Let's add a test to prove your suspect. The test is passed in the CI.
ok,`TEST 2` case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #6300: fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1040185539
Merged. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1039733220
> @liangliang4ward Better to add some test cases to cover it.
add a test case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806439780
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
+--- request
+GET /hello HTTP/1.1
+--- response_body
+uri: /uri/plugin_proxy_rewrite
+host: apisix.iresty.com
+x-api-version: v1
+x-real-ip: 127.0.0.1
+--- grep_error_log_out
Review comment:
ok, modified 'TEST 2' and 'TEST 4' case too
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806439577
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
Review comment:
modified
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
+--- request
+GET /hello HTTP/1.1
+--- response_body
+uri: /uri/plugin_proxy_rewrite
+host: apisix.iresty.com
+x-api-version: v1
+x-real-ip: 127.0.0.1
+--- grep_error_log_out
Review comment:
ok, modified 'TEST 2' and 'TEST 4' case too
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
> I think the test case should be "without headers"?
at line173 config rewrite header
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806683878
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
> I think the test case should be "without headers"?
at line173 config rewrite header
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #6300: fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1040185539
Merged. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1039733220
> @liangliang4ward Better to add some test cases to cover it.
add a test case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806418468
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
Review comment:
```suggestion
=== TEST 7: hit route(with header)
```
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
+--- request
+GET /hello HTTP/1.1
+--- response_body
+uri: /uri/plugin_proxy_rewrite
+host: apisix.iresty.com
+x-api-version: v1
+x-real-ip: 127.0.0.1
+--- grep_error_log_out
Review comment:
```suggestion
--- error_log
```
Now I know why the test can pass.
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
There is a header in Line 173
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038740595
> > > 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](https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md?rgh-link-date=2022-02-14T01%3A06%3A06Z) and the current test
> > > https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
> >
> >
> > in proxy-rewrite3.t ,I thought the `TEST 2` case according to the original code, it should not succeed。
>
> Let's add a test to prove your suspect. The test is passed in the CI.
ok,`TEST 2` case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward closed pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward closed pull request #6300:
URL: https://github.com/apache/apisix/pull/6300
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038715769
> > 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](https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md?rgh-link-date=2022-02-14T01%3A06%3A06Z) and the current test
> > https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
>
> in proxy-rewrite3.t ,I thought the `TEST 2` case according to the original code, it should not succeed。
Let's add a test to prove your suspect. The test is passed in the CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806636705
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
I think the test case should be "without headers"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806439577
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
Review comment:
modified
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806636705
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
I think the test case should be "without headers"?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #6300: fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6300:
URL: https://github.com/apache/apisix/pull/6300
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806418468
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
Review comment:
```suggestion
=== TEST 7: hit route(with header)
```
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,57 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
+--- 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": "/uri/plugin_proxy_rewrite",
+ "method": "POST",
+ "scheme": "http",
+ "host": "apisix.iresty.com",
+ "headers":{
+ "x-api-version":"v1"
+ }
+ }
+ },
+ "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 7: hit route(with out header)
+--- request
+GET /hello HTTP/1.1
+--- response_body
+uri: /uri/plugin_proxy_rewrite
+host: apisix.iresty.com
+x-api-version: v1
+x-real-ip: 127.0.0.1
+--- grep_error_log_out
Review comment:
```suggestion
--- error_log
```
Now I know why the test can pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #6300: fix(proxy-rewrite): when conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6300:
URL: https://github.com/apache/apisix/pull/6300
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038515471
> 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
>
> https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
in proxy-rewrite3.t ,the `TEST 2` case according to the original code, it should not succeed。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward edited a comment on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward edited a comment on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038515471
> 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
>
> https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
in proxy-rewrite3.t ,I thought the `TEST 2` case according to the original code, it should not succeed。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tokers commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1036024800
@liangliang4ward Better to add some test cases to cover it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038798340
> > > 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](https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md?rgh-link-date=2022-02-14T01%3A06%3A06Z) and the current test
> > > https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
> >
> >
> > in proxy-rewrite3.t ,I thought the `TEST 2` case according to the original code, it should not succeed。
>
> Let's add a test to prove your suspect. The test is passed in the CI.
this PR will to solve this issue; `TEST 2` case I don't why CI will success . this is my confusion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] liangliang4ward commented on pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#issuecomment-1038515471
> 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
>
> https://github.com/apache/apisix/blob/ebe91aa64c4fd26a03ea1ebddc089c577f4e730b/t/plugin/proxy-rewrite3.t#L87-L129
in proxy-rewrite3.t ,the `TEST 2` case according to the original code, it should not succeed。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #6300: fix: when proxy-rewrite plugin's conf.headers are missing,conf.method can make effect
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #6300:
URL: https://github.com/apache/apisix/pull/6300#discussion_r806662391
##########
File path: t/plugin/proxy-rewrite3.t
##########
@@ -151,3 +151,52 @@ plugin_proxy_rewrite get method: GET
--- response_body
property "method" validation failed: matches none of the enum values
done
+
+
+
+=== TEST 6: set route(rewrite method with headers)
Review comment:
There is a header in Line 173
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org