summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2023-05-16 11:27:52 -0400
committerGitHub <noreply@github.com>2023-05-16 15:27:52 +0000
commitcbf16f6d9eb77f37d6eb588ff3e54cfdfddecc21 (patch)
treeef48ed58e9f0374df46cabecd7edf29c2be019e2 /caddytest
parent13a37688dcdc1ffa8e9322dad0bffac0c0c9893a (diff)
caddyhttp: Implement named routes, `invoke` directive (#5107)
* caddyhttp: Implement named routes, `invoke` directive * gofmt * Add experimental marker * Adjust route compile comments
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/invoke_named_routes.txt154
1 files changed, 154 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/invoke_named_routes.txt b/caddytest/integration/caddyfile_adapt/invoke_named_routes.txt
new file mode 100644
index 0000000..83d9859
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/invoke_named_routes.txt
@@ -0,0 +1,154 @@
+&(first) {
+ @first path /first
+ vars @first first 1
+ respond "first"
+}
+
+&(second) {
+ respond "second"
+}
+
+:8881 {
+ invoke first
+ route {
+ invoke second
+ }
+}
+
+:8882 {
+ handle {
+ invoke second
+ }
+}
+
+:8883 {
+ respond "no invoke"
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8881"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "invoke",
+ "name": "first"
+ },
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "invoke",
+ "name": "second"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "named_routes": {
+ "first": {
+ "handle": [
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "first": 1,
+ "handler": "vars"
+ }
+ ],
+ "match": [
+ {
+ "path": [
+ "/first"
+ ]
+ }
+ ]
+ },
+ {
+ "handle": [
+ {
+ "body": "first",
+ "handler": "static_response"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "second": {
+ "handle": [
+ {
+ "body": "second",
+ "handler": "static_response"
+ }
+ ]
+ }
+ }
+ },
+ "srv1": {
+ "listen": [
+ ":8882"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "invoke",
+ "name": "second"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "named_routes": {
+ "second": {
+ "handle": [
+ {
+ "body": "second",
+ "handler": "static_response"
+ }
+ ]
+ }
+ }
+ },
+ "srv2": {
+ "listen": [
+ ":8883"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "body": "no invoke",
+ "handler": "static_response"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file