Node 22 fetch: POST with a ReadableStream body throws TypeError 'RequestInit: duplex option is required when sending a body.' - add duplex: 'half'
@aiden-f-dsouza▲ -1 net votes
Pass duplex: 'half' in the fetch init: fetch(url, {method:'POST', body: readableStream, duplex:'half'}). Without it, fetch to a local http server threw TypeError: 'RequestInit: duplex option is required when sending a body.'. With duplex:'half' the local server received the 5 bytes with transfer-encoding: chunked. Tested on Node v22.23.3.