summaryrefslogtreecommitdiff
path: root/caddytest/integration
diff options
context:
space:
mode:
authorMohammed Al Sahaf <msaa1990@gmail.com>2020-09-26 02:50:26 +0300
committerGitHub <noreply@github.com>2020-09-25 17:50:26 -0600
commita33e4b542689cbe7ac711e3cfde1d2a30c0156ae (patch)
tree7b582fc1e8f25e02475d7865143768a85f0ab04f /caddytest/integration
parentf197cec7f3a599ca18807e7b7719ef7666cfdb70 (diff)
caddyfile: Add support for `vars` and `vars_regexp` matchers (#3730)
* caddyfile: support vars and vars_regexp matchers in the caddyfile * caddyfile: matchers: Brian Kernighan said printf is good debugging tool but didn't say keep them around
Diffstat (limited to 'caddytest/integration')
-rw-r--r--caddytest/integration/caddyfile_adapt/matcher_syntax.txt59
1 files changed, 59 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
index 8cabc58..53ec023 100644
--- a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
+++ b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
@@ -9,6 +9,15 @@
@matcher3 not method PUT
respond @matcher3 "not put"
+
+ @matcher4 vars "{http.request.uri}" "/vars-matcher"
+ respond @matcher4 "from vars matcher"
+
+ @matcher5 vars_regexp static "{http.request.uri}" `\.([a-f0-9]{6})\.(css|js)$`
+ respond @matcher5 "from vars_regexp matcher with name"
+
+ @matcher6 vars_regexp "{http.request.uri}" `\.([a-f0-9]{6})\.(css|js)$`
+ respond @matcher6 "from vars_regexp matcher without name"
}
----------
{
@@ -68,6 +77,56 @@
"handler": "static_response"
}
]
+ },
+ {
+ "match": [
+ {
+ "vars": {
+ "{http.request.uri}": "/vars-matcher"
+ }
+ }
+ ],
+ "handle": [
+ {
+ "body": "from vars matcher",
+ "handler": "static_response"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "vars_regexp": {
+ "{http.request.uri}": {
+ "name": "static",
+ "pattern": "\\.([a-f0-9]{6})\\.(css|js)$"
+ }
+ }
+ }
+ ],
+ "handle": [
+ {
+ "body": "from vars_regexp matcher with name",
+ "handler": "static_response"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
+ "vars_regexp": {
+ "{http.request.uri}": {
+ "pattern": "\\.([a-f0-9]{6})\\.(css|js)$"
+ }
+ }
+ }
+ ],
+ "handle": [
+ {
+ "body": "from vars_regexp matcher without name",
+ "handler": "static_response"
+ }
+ ]
}
]
}