summaryrefslogtreecommitdiff
path: root/caddytest/integration
diff options
context:
space:
mode:
Diffstat (limited to 'caddytest/integration')
-rw-r--r--caddytest/integration/caddyfile_adapt_test.go80
1 files changed, 80 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt_test.go b/caddytest/integration/caddyfile_adapt_test.go
index bff325b..f6120ae 100644
--- a/caddytest/integration/caddyfile_adapt_test.go
+++ b/caddytest/integration/caddyfile_adapt_test.go
@@ -283,3 +283,83 @@ func TestHttpOnlyOnNonStandardPort(t *testing.T) {
}
}`)
}
+
+func TestMatcherSyntax(t *testing.T) {
+ caddytest.AssertAdapt(t, `
+ :80 {
+ @matcher {
+ method GET
+ }
+ respond @matcher "get"
+
+ @matcher2 method POST
+ respond @matcher2 "post"
+
+ @matcher3 not method PUT
+ respond @matcher3 "not put"
+ }
+ `, "caddyfile", `{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":80"
+ ],
+ "routes": [
+ {
+ "match": [
+ {
+ "method": [
+ "GET"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "body": "get",
+ "handler": "static_response"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "method": [
+ "POST"
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "body": "post",
+ "handler": "static_response"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "not": [
+ {
+ "method": [
+ "PUT"
+ ]
+ }
+ ]
+ }
+ ],
+ "handle": [
+ {
+ "body": "not put",
+ "handler": "static_response"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+}`)
+} \ No newline at end of file