caddyhttp: Fix merging of Caddyfile matchers in not blocks (#3379)

This commit is contained in:
Francis Lavoie
2020-05-11 16:38:33 -04:00
committed by GitHub
parent d534162556
commit 4c55d26f11
2 changed files with 68 additions and 4 deletions

View File

@ -362,4 +362,56 @@ func TestMatcherSyntax(t *testing.T) {
}
}
}`)
}
}
func TestNotBlockMerging(t *testing.T) {
caddytest.AssertAdapt(t, `
:80
@test {
not {
header Abc "123"
header Bcd "123"
}
}
respond @test 403
`, "caddyfile", `{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":80"
],
"routes": [
{
"match": [
{
"not": [
{
"header": {
"Abc": [
"123"
],
"Bcd": [
"123"
]
}
}
]
}
],
"handle": [
{
"handler": "static_response",
"status_code": 403
}
]
}
]
}
}
}
}
}`)
}