| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
|
One problem that emerged is that I cannot check if (headers instanceof Headers) because importing Headers creates a circular dependency with undici. I need to check it in another way. Maybe if headers has a keys and get function, this would also allow Maps |
Sorry, something went wrong.
Co-authored-by: Rich Trott <rtrott@gmail.com>
+1 on this. I would also outline in the docs somehow. |
Sorry, something went wrong.
There was a problem hiding this comment.
Little bit. Rest looks fine.
Sorry, something went wrong.
Hmm confused as to why you can't import Headers 😕 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)
}
}? |
Sorry, something went wrong.
|
@jimmywarting it created a circular dependency because Headers is export by Undici which requires the http module. (the globalThis.Headers is forbidden) |
Sorry, something went wrong.
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 ERR_HTTP_HEADERS_SENT without removing it from the top (the v19.x doesn't include the #45508). I'll open a backport for you. |
Sorry, something went wrong.
|
Actually, I can't. Your test relies on a feature available only on main requireHostHeader (semver-major). Can you create a manual backport? |
Sorry, something went wrong.
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 /usr/local/opt/python@3.10/bin/python3.10 tools/test.py --mode=release \
\
--skip-tests= \
default \
addons js-native-api node-api
=== release test-http-write-head ===
Path: parallel/test-http-write-head
node:assert:124
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Missing expected exception (Error).
at Server.<anonymous> (/Users/juan/GitHub/node/test/parallel/test-http-write-head.js:56:10)
at Server.<anonymous> (/Users/juan/GitHub/node/test/common/index.js:446:15)
at Server.emit (node:events:513:28)
at parserOnIncoming (node:_http_server:1069:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: {
code: 'ERR_HTTP_HEADERS_SENT',
name: 'Error',
message: 'Cannot render headers after they are sent to the client'
},
operator: 'throws'
}
|
Sorry, something went wrong.
|
I have created a manual backport to 19.x #46272, should I create another for 18.x? |
Sorry, something went wrong.
It would great! Thanks! |
Sorry, something went wrong.
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>
| Back | FazBrowse Home | New Git URL |
from: #46082
I've extracted from res.writeHead the part where it sets multiple headers into res.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.