You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/04/26 01:57:23 UTC
[apisix] branch master updated: fix: replace ngx.req.get_post_args to core.request.get_post_args (#6924)
This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new fd9488da7 fix: replace ngx.req.get_post_args to core.request.get_post_args (#6924)
fd9488da7 is described below
commit fd9488da7c72f06bf102dad20b3c7dee19b0b40c
Author: soulbird <zh...@outlook.com>
AuthorDate: Tue Apr 26 09:57:18 2022 +0800
fix: replace ngx.req.get_post_args to core.request.get_post_args (#6924)
---
apisix/plugins/wolf-rbac.lua | 3 +--
t/plugin/wolf-rbac.t | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/apisix/plugins/wolf-rbac.lua b/apisix/plugins/wolf-rbac.lua
index 16ed736cd..1a2e9867f 100644
--- a/apisix/plugins/wolf-rbac.lua
+++ b/apisix/plugins/wolf-rbac.lua
@@ -29,7 +29,6 @@ local setmetatable = setmetatable
local type = type
local string = string
local req_read_body = ngx.req.read_body
-local req_get_post_args = ngx.req.get_post_args
local req_get_body_data = ngx.req.get_body_data
local plugin_name = "wolf-rbac"
@@ -344,7 +343,7 @@ local function get_args()
core.log.error("json.decode(", req_body, ") failed! ", err)
end
else
- args = req_get_post_args()
+ args = core.request.get_post_args(ctx)
end
return args
diff --git a/t/plugin/wolf-rbac.t b/t/plugin/wolf-rbac.t
index c76c7d2d0..954f9c1ca 100644
--- a/t/plugin/wolf-rbac.t
+++ b/t/plugin/wolf-rbac.t
@@ -504,3 +504,44 @@ X-Nickname: administrator
id:100,username:admin,nickname:administrator
--- no_error_log
[error]
+
+
+
+=== TEST 27: change password by post raw args
+--- request
+PUT /apisix/plugin/wolf-rbac/change_pwd
+oldPassword=123456&newPassword=abcdef
+--- more_headers
+Cookie: x-rbac-token=V1#wolf-rbac-app#wolf-rbac-token
+--- error_code: 200
+--- response_body_like eval
+qr/success to change password/
+
+
+
+=== TEST 28: change password by post raw args, greater than 100 args is ok
+--- config
+location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin")
+
+ local headers = {
+ ["Cookie"] = "x-rbac-token=V1#wolf-rbac-app#wolf-rbac-token"
+ }
+ local tbl = {}
+ for i=1, 100 do
+ tbl[i] = "test"..tostring(i).."=test&"
+ end
+ tbl[101] = "oldPassword=123456&newPassword=abcdef"
+ local code, _, real_body = t.test('/apisix/plugin/wolf-rbac/change_pwd',
+ ngx.HTTP_PUT,
+ table.concat(tbl, ""),
+ nil,
+ headers
+ )
+ ngx.status = 200
+ ngx.say(real_body)
+ }
+}
+--- response_body_like eval
+qr/success to change password/