Skip to content

Commit

Permalink
fix(use/express): make sure that we not send something through previo…
Browse files Browse the repository at this point in the history
…usly closed stream
  • Loading branch information
pholuj-candis committed Oct 10, 2024
1 parent 0d2c135 commit e4b8c5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/use/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function createHandler<Context extends OperationContext = undefined>(
res.once('close', body.return);
for await (const value of body) {
const closed = await new Promise((resolve, reject) => {
if (!res.writable) {
if (!res.writable || res.destroyed) {
// response's close event might be late
resolve(true);
} else {
Expand Down

0 comments on commit e4b8c5f

Please sign in to comment.