mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-30 15:58:10 +08:00
caddyhttp: Enable matching empty query string
Caddyfile syntax: query "" Or a nil matcher in the JSON should also match an empty query string. See https://caddy.community/t/v2-match-empty-query/8708?u=matt
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user