summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/matchers_test.go')
-rw-r--r--modules/caddyhttp/matchers_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go
index 9b3a9a8..219ada8 100644
--- a/modules/caddyhttp/matchers_test.go
+++ b/modules/caddyhttp/matchers_test.go
@@ -528,6 +528,24 @@ func TestQueryMatcher(t *testing.T) {
input: "/?someparam",
expect: false,
},
+ {
+ scenario: "nil matcher value should match empty query",
+ match: MatchQuery(nil),
+ input: "/?",
+ expect: true,
+ },
+ {
+ scenario: "nil matcher value should NOT match a non-empty query",
+ match: MatchQuery(nil),
+ input: "/?foo=bar",
+ expect: false,
+ },
+ {
+ scenario: "non-nil matcher should NOT match an empty query",
+ match: MatchQuery{"": []string{}},
+ input: "/?",
+ expect: false,
+ },
} {
u, _ := url.Parse(tc.input)