-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: response.setHeaders() #46109
http: response.setHeaders() #46109
Conversation
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
One problem that emerged is that I cannot check |
Co-authored-by: Rich Trott <rtrott@gmail.com>
+1 on this. I would also outline in the docs somehow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little bit. Rest looks fine.
Hmm confused as to why you can't import Maybe that was the reason why you could not do something similar to: res.setHeaders = function (headers) {
if (headers instanceof Headers === false) headers = new Headers(headers)
if (headers[symbol.toStringTag] !== 'Headers') headers = new Headers(headers) // or this
for (const [key, value] of headers) {
this.setHeader(key, value)
}
} ? |
@jimmywarting it created a circular dependency because |
PR-URL: nodejs#46109 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@marco-ippolito this didn't land cleanly on v19.x-staging because you are removing I'll open a backport for you. |
Actually, I can't. Your test relies on a feature available only on main |
PR-URL: nodejs#46109 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This is breaking test/parallel/test-http-write-head.js in v18.x
|
I have created a manual backport to 19.x #46272, should I create another for 18.x? |
It would great! Thanks! |
PR-URL: nodejs#46109 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#46109 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: nodejs#46109 Backport-PR-URL: nodejs#46365 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
from: #46082
I've extracted from
res.writeHead
the part where it sets multiple headers intores.setHeaders
.I've removed this part in
writeHead
:if (k === undefined && this._header) { throw new ERR_HTTP_HEADERS_SENT('render'); }
because since #45508 it never enters that condition.