aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <[email protected]>2023-02-25 19:34:27 -0500
committerGitHub <[email protected]>2023-02-26 00:34:27 +0000
commit960150bb034dc9a549ee7289b1a4eb4abafeb30a (patch)
treea3608546db0b154a75afc3dae2d52d44b92ceac9 /caddytest
parent9e6919550be5689628d0020ec14e90ea6f527716 (diff)
downloadcaddy-960150bb034dc9a549ee7289b1a4eb4abafeb30a.tar.gz
caddy-960150bb034dc9a549ee7289b1a4eb4abafeb30a.zip
caddyfile: Implement heredoc support (#5385)
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/heredoc.txt50
-rw-r--r--caddytest/integration/caddyfile_adapt/import_args_snippet.txt2
-rw-r--r--caddytest/integration/caddyfile_adapt/reverse_proxy_options.txt4
-rw-r--r--caddytest/integration/testdata/import_respond.txt2
4 files changed, 54 insertions, 4 deletions
diff --git a/caddytest/integration/caddyfile_adapt/heredoc.txt b/caddytest/integration/caddyfile_adapt/heredoc.txt
new file mode 100644
index 000000000..15f8aef29
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/heredoc.txt
@@ -0,0 +1,50 @@
+example.com {
+ respond <<EOF
+ <html>
+ <head><title>Foo</title>
+ <body>Foo</body>
+ </html>
+ EOF 200
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":443"
+ ],
+ "routes": [
+ {
+ "match": [
+ {
+ "host": [
+ "example.com"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "handler": "subroute",
+ "routes": [
+ {
+ "handle": [
+ {
+ "body": "\u003chtml\u003e\n \u003chead\u003e\u003ctitle\u003eFoo\u003c/title\u003e\n \u003cbody\u003eFoo\u003c/body\u003e\n\u003c/html\u003e\n",
+ "handler": "static_response",
+ "status_code": 200
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "terminal": true
+ }
+ ]
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/caddytest/integration/caddyfile_adapt/import_args_snippet.txt b/caddytest/integration/caddyfile_adapt/import_args_snippet.txt
index 9fce9abe0..10d9f4cfc 100644
--- a/caddytest/integration/caddyfile_adapt/import_args_snippet.txt
+++ b/caddytest/integration/caddyfile_adapt/import_args_snippet.txt
@@ -1,6 +1,6 @@
(logging) {
log {
- output file /var/log/caddy/{args.0}.access.log
+ output file /var/log/caddy/{args[0]}.access.log
}
}
diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_options.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_options.txt
index b22333a4c..f6420ca01 100644
--- a/caddytest/integration/caddyfile_adapt/reverse_proxy_options.txt
+++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_options.txt
@@ -6,7 +6,7 @@ https://example.com {
method GET
rewrite /rewritten?uri={uri}
- buffer_requests
+ request_buffers 4KB
transport http {
read_buffer 10MB
@@ -54,7 +54,6 @@ https://example.com {
{
"handle": [
{
- "buffer_requests": true,
"handler": "reverse_proxy",
"headers": {
"request": {
@@ -68,6 +67,7 @@ https://example.com {
}
}
},
+ "request_buffers": 4000,
"rewrite": {
"method": "GET",
"uri": "/rewritten?uri={http.request.uri}"
diff --git a/caddytest/integration/testdata/import_respond.txt b/caddytest/integration/testdata/import_respond.txt
index 0907fbeb7..45130885c 100644
--- a/caddytest/integration/testdata/import_respond.txt
+++ b/caddytest/integration/testdata/import_respond.txt
@@ -1 +1 @@
-respond "'I am {args.0}', hears {args.1}" \ No newline at end of file
+respond "'I am {args[0]}', hears {args[1]}" \ No newline at end of file