-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
response.writeHead() does not default statusMessage
if it's undefined
#32395
Comments
I'm working on this. |
Yes, this not a bug, just we have a different parameter processing |
So, actually, this title is inaccurate: response.writeHead() does not default
|
yes, and i have fixed this in that PR |
PR-URL: #46173 Fixes: #32395 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: nodejs#46173 Fixes: nodejs#32395 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #46173 Fixes: #32395 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #46173 Fixes: #32395 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
PR-URL: #46173 Fixes: #32395 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
response.writeHead(statusCode[, statusMessage][, headers])
works as expected if
statusMessage
is omitted, supplying a default value.However, if
undefined
is passed as a placeholder then it unexpectedly ignores theheaders
argument.Why would I want this? Imagine a function like:
You can see I depend on a single signature to work whether
statusMessage
is supplied or not. Otherwise, I have to:Not the end of the world, but it lacks elegance.
Maybe this is not a bug, but wrong expectations?
Perhaps. But this expectation aligns with how javascript default parameters behave.
The text was updated successfully, but these errors were encountered: