Jaycean commented on a change in pull request #2421:
URL: https://github.com/apache/apisix/pull/2421#discussion_r505971176



##########
File path: t/plugin/limit-count.t
##########
@@ -834,3 +834,89 @@ passed
 [200, 200, 200, 503, 200, 200, 200, 503]
 --- no_error_log
 [error]
+
+
+
+=== TEST 24: create consumer and bind key-auth plugin
+--- config 
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body = t('/apisix/admin/consumers',
+                ngx.HTTP_PUT,
+                [[{
+                    "username": "consumer_jack",
+                    "plugins": {
+                        "key-auth": {
+                            "key": "auth-jack"
+                        }
+                    }
+                }]]
+                )
+            if code >= 300 then
+                ngx.status = code
+            end
+            ngx.say(body)
+        }
+    }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 25: create route and consumer_name is consumer_jack
+--- 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"],

Review comment:
       done.

##########
File path: doc/plugins/limit-count.md
##########
@@ -37,7 +37,7 @@ Limit request rate by a fixed number of requests in a given 
time window.
 | -------------- | ------- | -------------------- | ------- | 
------------------------------------------------------------------------ | 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
 | count          | integer | required             |         | [0,...]          
                                                        | the specified number 
of requests threshold.                                                          
                                                                                
                                                                                
                                       |
 | time_window    | integer | required             |         | [0,...]          
                                                        | the time window in 
seconds before the request count is reset.                                      
                                                                                
                                                                                
                                         |
-| key            | string  | required             |         | ["remote_addr", 
"server_addr", "http_x_real_ip", "http_x_forwarded_for"] | the user specified 
key to limit the rate.                                                          
                                                                                
                                                                                
                                         |
+| key            | string  | required             |         | ["remote_addr", 
"server_addr", "http_x_real_ip", "http_x_forwarded_for", "consumer_name"] | the 
user specified key to limit the rate.                                           
                                                                                
                                                                                
                                                        |

Review comment:
       done.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to