Yiyiyimu commented on a change in pull request #4563:
URL: https://github.com/apache/apisix/pull/4563#discussion_r666379046



##########
File path: t/plugin/batch-requests.t
##########
@@ -1017,3 +1017,204 @@ GET /t
 passed
 --- no_error_log
 [error]
+
+
+
+=== TEST 24: customize uri, not found
+--- yaml_config
+plugin_attr:
+    batch-requests:
+        uri: "/foo/bar"
+--- config
+    location = /aggregate {

Review comment:
       We used to name it `/t`

##########
File path: docs/en/latest/plugins/batch-requests.md
##########
@@ -109,6 +109,22 @@ Response is `Array` of [HttpResponse](#httpresponse).
 | body    | string  | http response body    |
 | headers | object  | http response headers |
 
+## How to specify custom uri
+
+We can change the default uri in the `plugin_attr` section of 
`conf/config.yaml`.
+
+| Name       | Type   | Default                      | Description             
          |

Review comment:
       Could you also add column `Requirement` like 
http://apisix.apache.org/docs/apisix/plugins/proxy-rewrite/#attributes

##########
File path: t/plugin/batch-requests.t
##########
@@ -1017,3 +1017,204 @@ GET /t
 passed
 --- no_error_log
 [error]
+
+
+
+=== TEST 24: customize uri, not found
+--- yaml_config
+plugin_attr:
+    batch-requests:
+        uri: "/foo/bar"
+--- config
+    location = /aggregate {
+        content_by_lua_block {
+            local core = require("apisix.core")
+            local t = require("lib.test_admin").test
+            local code, body = t('/apisix/batch-requests',
+                ngx.HTTP_POST,
+                [=[{
+                    "timeout": 100,
+                    "pipeline":[
+                    {
+                        "path": "/a"
+                    }]
+                }]=],
+                [=[[
+                {
+                    "status": 200
+                }
+                ]]=]
+                )
+
+            ngx.status = code
+            ngx.say(body)
+        }
+    }
+
+    location = /a {
+        content_by_lua_block {
+            ngx.status = 200
+        }
+    }
+--- request
+GET /aggregate
+--- error_code: 404
+--- no_error_log
+[error]
+
+
+
+=== TEST 25: customize uri, found
+--- yaml_config
+plugin_attr:
+    batch-requests:
+        uri: "/foo/bar"
+--- config
+    location = /aggregate {
+        content_by_lua_block {
+            local core = require("apisix.core")
+            local t = require("lib.test_admin").test
+            local code, body = t('/foo/bar',
+                ngx.HTTP_POST,
+                [=[{
+                    "timeout": 100,
+                    "pipeline":[
+                    {
+                        "path": "/b",
+                        "headers": {
+                            "Header1": "hello",
+                            "Header2": "world"
+                        }
+                    },{
+                        "path": "/c",
+                        "method": "PUT"
+                    },{
+                        "path": "/d"
+                    }]
+                }]=],
+                [=[[
+                {
+                    "status": 200
+                },
+                {
+                    "status": 201
+                },
+                {
+                    "status": 202
+                }
+                ]]=]
+                )
+
+            ngx.status = code
+            ngx.say(body)
+        }
+    }
+
+    location = /b {
+        content_by_lua_block {
+            ngx.status = 200
+        }
+    }
+    location = /c {
+        content_by_lua_block {
+            ngx.status = 201
+        }
+    }
+    location = /d {
+        content_by_lua_block {
+            ngx.status = 202
+        }
+    }
+--- request
+GET /aggregate
+--- error_code: 200
+--- no_error_log
+[error]
+
+
+
+=== TEST 26: customize uri, missing plugin, use default
+--- yaml_config
+plugin_attr:
+    x:
+      xyz: "/foo/bar"

Review comment:
       ```suggestion
         uri: "/foo/bar"
   ```




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


Reply via email to