• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const asyncHooks = require('async_hooks');
4const http = require('http');
5
6// Regression test for https://github.com/nodejs/node/issues/31796
7
8asyncHooks.createHook({
9  after: () => {}
10}).enable();
11
12
13process.once('uncaughtException', common.mustCall(() => {
14  server.close();
15}));
16
17const server = http.createServer(common.mustCall((request, response) => {
18  response.writeHead(200, { 'Content-Type': 'text/plain' });
19  response.end();
20}));
21
22server.listen(0, common.mustCall(() => {
23  http.get({
24    host: 'localhost',
25    port: server.address().port
26  }, common.mustCall(() => {
27    throw new Error('whoah');
28  }));
29}));
30