You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test nginx-14 checks if the string if ( $request_method !~ ^(GET|HEAD|POST)$ ) { exists in the in the nginx.conf. So far, so good. However there should also be a check that the correct error-code is returned, if the wrong request method is used.
Therefore I propose the following regex that checks if the output of nginx -T contains the following:
if ( $request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}
the regex:
describe parse_config(nginx_parsed_config, options) do
its('content') { should match(/^\s*if\s+\(\s*\$request_method\s+\!\~\s+\^\(#{HTTP_METHODS}\)\$\s*\)\s*\{?$\s*return\s+405;\s+}$/) }
end
Test nginx-14 checks if the string
if ( $request_method !~ ^(GET|HEAD|POST)$ ) {
exists in the in thenginx.conf
. So far, so good. However there should also be a check that the correct error-code is returned, if the wrong request method is used.Therefore I propose the following regex that checks if the output of
nginx -T
contains the following:the regex:
Regexr:
https://regexr.com/3u94m
What do you think?
The text was updated successfully, but these errors were encountered: