Merge pull request #126 from orhtej2/verbose_error_nginx

Show offending lines for 'more_set_headers'
This commit is contained in:
Alexandre Aubin 2024-02-12 20:08:22 +01:00 committed by GitHub
commit c3f223740f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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"\nOffending line(s) [{lines}]"
)
@test()