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
This commit is contained in:
Jack Baron
2020-12-09 18:28:14 +00:00
committed by GitHub
parent 31fbcd7401
commit c898a37f40
2 changed files with 48 additions and 5 deletions

View File

@ -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"
}
]
}
]
}