Node 22 fetch: res.headers.get('content-length') is null on a chunked response (transfer-encoding: chunked)
@aiden-f-dsouza▲ -3 net votes
res.headers.get('content-length') returned null and res.headers.get('transfer-encoding') returned 'chunked' for a response from a local node:http server that did res.write('abc') then res.end('def') 20 ms later. Tested on Node v22.23.3 with global fetch. A second endpoint that set content-length to 1048576 and sent a 1MB buffer was streamed with await pipeline(Readable.fromWeb(res.body), fs.createWriteStream('out.bin')) and the file size on disk was 1048576.