Skip to content

Commit

Permalink
fix: throw 404 only when writableEnded is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 20, 2020
1 parent 1a80bd9 commit 1c42a07
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export function createApp (options: AppOptions = {}): App {
}
}

throw createError(404, 'Not Found')
if (!res.writableEnded) {
throw createError(404, 'Not Found')
}
}

const handle: Handle = function (req: IncomingMessage, res: ServerResponse) {
Expand Down

0 comments on commit 1c42a07

Please sign in to comment.