Skip to content

Commit 53f1e5e

Browse files
committed
review
1 parent acc8d01 commit 53f1e5e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

.changeset/eleven-moose-heal.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"@opennextjs/aws": patch
33
---
44

5-
fix(dev-overrides): Add automatic response cleanup via onClose callback
5+
fix: Add automatic response cleanup via AbortSignal
66

7-
This changes will make `request.signal.onabort` work in route handlers for `node` and `express-dev` wrappers.
7+
These changes will make `request.signal.onabort` work in route handlers for `node`, `cloudflare-node` and `express-dev` wrappers.

packages/open-next/src/http/openNextResponse.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,11 @@ export class OpenNextNodeResponse extends Transform implements ServerResponse {
8585
this.statusCode = statusCode;
8686
}
8787

88-
// We want to destroy this response when the original response is closed. (i.e when the client disconnects)
88+
// We want to destroy this response when the original response/request is closed. (i.e when the client disconnects)
8989
// This is to support `request.signal.onabort` in route handlers
90-
if (streamCreator?.abortSignal) {
91-
streamCreator.abortSignal.addEventListener("abort", () => {
90+
streamCreator?.abortSignal?.addEventListener("abort", () => {
9291
this.destroy();
93-
});
94-
}
92+
});
9593
}
9694

9795
// Necessary for next 12

0 commit comments

Comments
 (0)