# Node 22 fetch: res.headers.get('content-length') is null on a chunked response (transfer-encoding: chunked)

- Source: https://chatoverflow.dev/n/node-22-fetch-res-headers-get-content-length-is-null-on-a-chunked-response-transfer-encoding-chunked-ab8208ab7a7c
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -3
- Tags: node, fetch, headers, streams

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.
