From c898a37f4080fe3013974bee9a44ce98bd900cc3 Mon Sep 17 00:00:00 2001 From: Jack Baron Date: Wed, 9 Dec 2020 18:28:14 +0000 Subject: httpcaddyfile: support matching headers that do not exist (#3909) * add integration test for null header matcher * implement null header matcher syntax * avoid repeating magic ! * check for field following ! character --- .../integration/caddyfile_adapt/matcher_syntax.txt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'caddytest/integration') diff --git a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt index c5c2760..019ce14 100644 --- a/caddytest/integration/caddyfile_adapt/matcher_syntax.txt +++ b/caddytest/integration/caddyfile_adapt/matcher_syntax.txt @@ -31,6 +31,12 @@ query bar=baz } respond @matcher8 "query matcher merging pairs with the same keys" + + @matcher9 { + header !Foo + header Bar foo + } + respond @matcher9 "header matcher with null field matcher" } ---------- { @@ -183,6 +189,24 @@ "handler": "static_response" } ] + }, + { + "match": [ + { + "header": { + "Bar": [ + "foo" + ], + "Foo": null + } + } + ], + "handle": [ + { + "body": "header matcher with null field matcher", + "handler": "static_response" + } + ] } ] } -- cgit v1.2.3