http: improve errors thrown in header validation
Previously https://github.com/nodejs/node/pull/16715 Fixes: https://github.com/nodejs/node/issues/16714
This PR:
- Replace
ERR_MISSING_ARGS
withERR_HTTP_INVALID_HEADER_VALUE
, include the header name and the value for debug-ability as https://github.com/nodejs/node/issues/16714 suggests. Before it'sThe "value" argument must be specified
, after it'sInvalid value "undefined" for header "test"
. If the user is setting the header in a loop this would be much more useful. - Use
Error.captureStackTrace
to exclude the validation functions from the stack trace
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
http