Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: improve errors thrown in header validation #16719

Closed
wants to merge 1 commit into from

Conversation

joyeecheung
Copy link
Member

Previously #16715
Fixes: #16714

This PR:

  • Replace ERR_MISSING_ARGS with ERR_HTTP_INVALID_HEADER_VALUE, include the header name and the value for debug-ability as [REQUEST] Better Errors in http validate headers #16714 suggests. Before it's The "value" argument must be specified, after it's Invalid 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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

http

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. http Issues or PRs related to the http subsystem. labels Nov 3, 2017
@joyeecheung
Copy link
Member Author

@joyeecheung
Copy link
Member Author

Landed in 0a84e95, thanks!

joyeecheung added a commit that referenced this pull request Nov 6, 2017
PR-URL: #16719
Fixes: #16714
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@joyeecheung joyeecheung closed this Nov 6, 2017
@joyeecheung joyeecheung added the semver-major PRs that contain breaking changes and should be released in the next major version. label Nov 6, 2017
@niallobrien
Copy link

Hi, what version of node did/will this land in? Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. http Issues or PRs related to the http subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQUEST] Better Errors in http validate headers
5 participants