nic-6443 commented on code in PR #12843:
URL: https://github.com/apache/apisix/pull/12843#discussion_r3393128888
##########
t/plugin/proxy-rewrite.t:
##########
@@ -1231,3 +1231,95 @@ GET /hello
uri: /uri
host: test.com:6443
x-real-ip: 127.0.0.1
+
+
+
+=== TEST 45: set route(rewrite uri args with unsafe allowed)
+--- 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,
+ [[{
+ "plugins": {
+ "proxy-rewrite": {
+ "uri": "/plugin_proxy_rewrite_args",
+ "use_real_request_uri_unsafe": true
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/hello"
+ }]]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+
+
+
+=== TEST 46: rewrite uri args
Review Comment:
The earlier revision of this PR double-appended the query when only
`use_real_request_uri_unsafe: true` was set (no `uri`) — that is fixed now
since `query_string` is only appended in the `conf.uri` branch, but none of the
tests actually pin that scenario down. TEST 8/9 in proxy-rewrite3.t cover
unsafe mode without a query string, and the new tests here all set `uri`
together with the flag. Since this exact case already regressed once during
review, it would be good to add a test with just `use_real_request_uri_unsafe:
true` (no `uri`/`regex_uri`) and a request like `/hello?q=apisix`, asserting
the query reaches the upstream exactly once.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]