summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/matchers_test.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-11-17 11:29:43 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-11-17 11:29:43 -0700
commit4fc570711e170da2bd1164966d2c47f9dc3d3d6d (patch)
tree66ed37137b09335bcba29ad61cfe7827e85de531 /modules/caddyhttp/matchers_test.go
parent99b8f44486b766f220a33906d84ac05af942f260 (diff)
caddyhttp: Fix header matcher when using nil
Uncovered in #3807
Diffstat (limited to 'modules/caddyhttp/matchers_test.go')
-rw-r--r--modules/caddyhttp/matchers_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/caddyhttp/matchers_test.go b/modules/caddyhttp/matchers_test.go
index 9a2836d..51db67d 100644
--- a/modules/caddyhttp/matchers_test.go
+++ b/modules/caddyhttp/matchers_test.go
@@ -480,6 +480,16 @@ func TestHeaderMatcher(t *testing.T) {
host: "caddyserver.com",
expect: false,
},
+ {
+ match: MatchHeader{"Must-Not-Exist": nil},
+ input: http.Header{},
+ expect: true,
+ },
+ {
+ match: MatchHeader{"Must-Not-Exist": nil},
+ input: http.Header{"Must-Not-Exist": []string{"do not match"}},
+ expect: false,
+ },
} {
req := &http.Request{Header: tc.input, Host: tc.host}
actual := tc.match.Match(req)