Show offending lines for 'more_set_headers'

This commit is contained in:
orhtej2 2024-02-10 21:28:47 +01:00
parent d0c763ee28
commit 8ed7286c90

View file

@ -1421,13 +1421,15 @@ class Configurations(TestSuite):
r"more_set_headers [\"\'][\w-]+\s?: .*[\"\'];", line
)
if any(not right_syntax(line) for line in more_set_headers_lines):
lines = [line.strip() for line in more_set_headers_lines if not right_syntax(line)]
if lines:
yield Error(
"It looks like the syntax for the 'more_set_headers' "
"instruction is incorrect in the NGINX conf (N.B. "
": it's different than the 'add_header' syntax!)... "
"The syntax should look like: "
'more_set_headers "Header-Name: value"'
f"Offending line(s) [{lines}]"
)
@test()