bzp2010 commented on a change in pull request #5409:
URL: https://github.com/apache/apisix/pull/5409#discussion_r743516350
##########
File path: t/node/vars.t
##########
@@ -299,3 +299,87 @@ GET /hello?k=uri_arg
hello world
--- no_error_log
[error]
+
+
+
+=== TEST 17: set route(only post arg)
+--- 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,
+ [=[{
+ "uri": "/hello",
+ "vars": [["post_arg_k", "==", "post_form"]],
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ }
+ }]=]
+ )
+
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 18: /not_found
+--- request
+GET /hello
+--- error_code: 404
+--- response_body
+{"error_msg":"404 Route Not Found"}
+--- no_error_log
+[error]
+
+
+
+=== TEST 19: /not_found
Review comment:
changed
##########
File path: t/core/request.t
##########
@@ -378,3 +378,41 @@ nil
t
--- no_error_log
[error]
+
+
+
+=== TEST 11: get_post_args
+--- config
+ location = /hello {
+ real_ip_header X-Real-IP;
+
+ set_real_ip_from 0.0.0.0/0;
+ set_real_ip_from ::/0;
+ set_real_ip_from unix:;
+
+ access_by_lua_block {
+ local core = require("apisix.core")
+ local ngx_ctx = ngx.ctx
+ local api_ctx = ngx_ctx.api_ctx
+ if api_ctx == nil then
+ api_ctx = core.tablepool.fetch("api_ctx", 0, 32)
+ ngx_ctx.api_ctx = api_ctx
+ end
+
+ core.ctx.set_vars_meta(api_ctx)
+ }
+ content_by_lua_block {
Review comment:
merged
##########
File path: t/core/request.t
##########
@@ -378,3 +378,41 @@ nil
t
--- no_error_log
[error]
+
+
+
+=== TEST 11: get_post_args
+--- config
+ location = /hello {
+ real_ip_header X-Real-IP;
+
+ set_real_ip_from 0.0.0.0/0;
+ set_real_ip_from ::/0;
+ set_real_ip_from unix:;
Review comment:
removed
##########
File path: apisix/core/ctx.lua
##########
@@ -175,6 +175,20 @@ do
end
end
+ elseif core_str.has_prefix(key, "post_arg_") then
+ -- only match default post form
+ if request.header(nil, "Content-Type") ==
"application/x-www-form-urlencoded" then
Review comment:
@spacewander I've added a brief description, check to see if you need to
add a separate paragraph `Howto` for descripte.
--
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]