Skip to content

Commit

Permalink
Remove v16 workaround for request body iteration
Browse files Browse the repository at this point in the history
See #1206

Signed-off-by: Timo Stamm <[email protected]>
  • Loading branch information
timostamm committed Sep 12, 2024
1 parent aefcc51 commit e92c805
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions packages/connect-node/src/node-universal-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,7 @@ export async function universalResponseToNodeResponse(
async function* asyncIterableFromNodeServerRequest(
request: NodeServerRequest,
): AsyncIterable<Uint8Array> {
const it = request.iterator({
// Node.js v16 closes request and response when this option isn't disabled.
// When one of our handlers receives invalid data (such as an unexpected
// compression flag in a streaming request), we're unable to write the error
// response.
// Later major versions have a more sensible behavior - we can revert this
// workaround once we stop supporting v16.
destroyOnReturn: false,
});
for await (const chunk of it) {
for await (const chunk of request) {
yield chunk;
}
}
Expand Down

0 comments on commit e92c805

Please sign in to comment.