-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: inform callback scopes about exceptions in HTTP parser
Refs: 4aca277 Refs: #30236 Fixes: #31796 PR-URL: #31801 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const asyncHooks = require('async_hooks'); | ||
const http = require('http'); | ||
|
||
// Regression test for https://github.com/nodejs/node/issues/31796 | ||
|
||
asyncHooks.createHook({ | ||
after: () => {} | ||
}).enable(); | ||
|
||
|
||
process.once('uncaughtException', common.mustCall(() => { | ||
server.close(); | ||
})); | ||
|
||
const server = http.createServer(common.mustCall((request, response) => { | ||
response.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
response.end(); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
http.get({ | ||
host: 'localhost', | ||
port: server.address().port | ||
}, common.mustCall(() => { | ||
throw new Error('whoah'); | ||
})); | ||
})); |