From 4fc570711e170da2bd1164966d2c47f9dc3d3d6d Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 17 Nov 2020 11:29:43 -0700 Subject: caddyhttp: Fix header matcher when using nil Uncovered in #3807 --- modules/caddyhttp/matchers_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules/caddyhttp/matchers_test.go') 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) -- cgit v1.2.3