http: response.setHeaders()#46109
Conversation
|
Review requested:
|
|
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. |
ShogunPanda
left a comment
There was a problem hiding this comment.
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.writeHeadthe 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.