mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-29 07:05:57 +08:00
caddyhttp: Fix merging of Caddyfile matchers in not blocks (#3379)
This commit is contained in:
@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user