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



##########
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 = /t {
+        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 /t
+--- 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

Review comment:
       We can avoid repeating it via 
https://github.com/apache/apisix/blob/42ab6149272920bbab66985b90e2754a7c6cb747/t/admin/upstream2.t#L32




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