Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(limit-count): conf with group and disable can't be configured #7384

Merged
merged 3 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apisix/plugins/limit-count.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ local _M = {


local function group_conf(conf)
return conf
return core.table.deepcopy(conf)
soulbird marked this conversation as resolved.
Show resolved Hide resolved
end


Expand Down
37 changes: 37 additions & 0 deletions t/plugin/limit-count2.t
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,40 @@ limit key: afafafhao2:remote_addr
limit key: afafafhao2:remote_addr
--- response_body
[200,200,503,503]
=== TEST 22: group with disable
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/services/1',
ngx.HTTP_PUT,
[[{
"plugins": {
"limit-count": {
"count": 2,
"time_window": 60,
"rejected_code": 503,
"group": "abcd",
"disable": false
}
},
"upstream": {
"nodes": {
"127.0.0.1:1980": 1
},
"type": "roundrobin"
}
}]]
)
if code >= 300 then
ngx.status = code
end
ngx.say(body)
}
}
--- response_body
passed