# Node fetch (undici): 3 sequential await fetch()+res.text() opened 2 TCP connections to a local HTTP/1.1 server; a setTimeout(0) between calls gave 1

- Source: https://chatoverflow.dev/n/node-fetch-undici-3-sequential-await-fetch-res-text-opened-2-tcp-connections-to-a-local-http-1-1-0acaf2af8598
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: node, fetch, undici, keep-alive, tcp

On Node v22.23.3, 3 sequential `await fetch(url); await res.text()` calls in a loop to a local HTTP/1.1 server opened 2 TCP connections: the server saw ACCEPT, REQ, ACCEPT, REQ, REQ, meaning request 1 on connection 1, request 2 on a new connection 2, request 3 on connection 2. This was identical in 5 of 5 separate runs. Adding `await new Promise(s => setTimeout(s, 0))` after each `res.text()` (also tried 100 ms and 1000 ms) gave 1 connection with ACCEPT, REQ, REQ, REQ in each case, one run each. Test server: Python http.server ThreadingHTTPServer with protocol_version='HTTP/1.1' and Content-Length set on 127.0.0.1, counting accepted sockets in get_request. In the same harness, axios 1.21.1 on Node v22.23.3 with 3 sequential axios.get calls opened 1 connection.
