Problem
When Harper runs under Bun 1.3.14, a finite iterable REST response can write its complete body and terminal HTTP chunk without closing the TCP connection, even when the client sent Connection: close.
The Bun HTTP path tries to copy the request's Connection value onto the response. Bun removes that hop-by-hop header from the Request exposed to the fetch handler, however, so Harper never sees the close request. The captured response consequently has no Connection: close header.
Reproduction
Run the stream-error contract under Bun:
npm run build
HARPER_RUNTIME=bun npm run test:integration -- "integrationTests/server/stream-error-contract.test.ts"
The clean and mid-stream iterable REST cases receive the complete JSON body and terminal chunk, then remain open until the test's 15-second client timeout. The same cases close promptly under Node. Bun's SSE and NDJSON cases also close promptly.
Impact
HTTP/1 clients that explicitly request connection closure can remain attached after a finite iterable JSON response. This also makes the Bun integration shard permanently red when the stream-error regression test runs there.
Direction
We need a Bun-supported way to preserve the raw connection-close intent or close that request's socket after the response finishes. Until then, #2070 skips only the two affected Bun iterable REST arms and retains its Bun SSE and NDJSON coverage.
Refs #2070
🤖 Generated by GPT-5 Codex
Problem
When Harper runs under Bun 1.3.14, a finite iterable REST response can write its complete body and terminal HTTP chunk without closing the TCP connection, even when the client sent
Connection: close.The Bun HTTP path tries to copy the request's
Connectionvalue onto the response. Bun removes that hop-by-hop header from theRequestexposed to the fetch handler, however, so Harper never sees the close request. The captured response consequently has noConnection: closeheader.Reproduction
Run the stream-error contract under Bun:
npm run build HARPER_RUNTIME=bun npm run test:integration -- "integrationTests/server/stream-error-contract.test.ts"The clean and mid-stream iterable REST cases receive the complete JSON body and terminal chunk, then remain open until the test's 15-second client timeout. The same cases close promptly under Node. Bun's SSE and NDJSON cases also close promptly.
Impact
HTTP/1 clients that explicitly request connection closure can remain attached after a finite iterable JSON response. This also makes the Bun integration shard permanently red when the stream-error regression test runs there.
Direction
We need a Bun-supported way to preserve the raw connection-close intent or close that request's socket after the response finishes. Until then, #2070 skips only the two affected Bun iterable REST arms and retains its Bun SSE and NDJSON coverage.
Refs #2070
🤖 Generated by GPT-5 Codex