summaryrefslogtreecommitdiff
path: root/caddytest
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-09-01 23:12:37 -0400
committerGitHub <noreply@github.com>2022-09-01 23:12:37 -0400
commit7d5108d132d3bccfd8d83bc3fc2dbc46afde20ae (patch)
treef476b207d820a4dcf64ab9bca1c92af12a384da2 /caddytest
parent7c35bfa57cb402e82b28118b69c265df3e8c94fd (diff)
httpcaddyfile: Add shortcut for expression matchers (#4976)
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/matcher_syntax.txt32
1 files changed, 24 insertions, 8 deletions
diff --git a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
index a3e0a50..fb3dfb6 100644
--- a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
+++ b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt
@@ -19,27 +19,30 @@
@matcher6 vars_regexp "{http.request.uri}" `\.([a-f0-9]{6})\.(css|js)$`
respond @matcher6 "from vars_regexp matcher without name"
- @matcher7 {
+ @matcher7 `path('/foo*') && method('GET')`
+ respond @matcher7 "inline expression matcher shortcut"
+
+ @matcher8 {
header Foo bar
header Foo foobar
header Bar foo
}
- respond @matcher7 "header matcher merging values of the same field"
+ respond @matcher8 "header matcher merging values of the same field"
- @matcher8 {
+ @matcher9 {
query foo=bar foo=baz bar=foo
query bar=baz
}
- respond @matcher8 "query matcher merging pairs with the same keys"
+ respond @matcher9 "query matcher merging pairs with the same keys"
- @matcher9 {
+ @matcher10 {
header !Foo
header Bar foo
}
- respond @matcher9 "header matcher with null field matcher"
+ respond @matcher10 "header matcher with null field matcher"
- @matcher10 remote_ip private_ranges
- respond @matcher10 "remote_ip matcher with private ranges"
+ @matcher11 remote_ip private_ranges
+ respond @matcher11 "remote_ip matcher with private ranges"
}
----------
{
@@ -155,6 +158,19 @@
{
"match": [
{
+ "expression": "path('/foo*') \u0026\u0026 method('GET')"
+ }
+ ],
+ "handle": [
+ {
+ "body": "inline expression matcher shortcut",
+ "handler": "static_response"
+ }
+ ]
+ },
+ {
+ "match": [
+ {
"header": {
"Bar": [
"foo"