• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const http = require('http');
6
7const uncaughtCallback = common.mustCall(function(er) {
8  assert.strictEqual(er.message, 'get did fail');
9});
10
11process.on('uncaughtException', uncaughtCallback);
12
13const server = http.createServer(function(req, res) {
14  res.writeHead(200, { 'Content-Type': 'text/plain' });
15  res.end('bye');
16}).listen(0, function() {
17  http.get({ port: this.address().port }, function(res) {
18    res.resume();
19    throw new Error('get did fail');
20  }).on('close', function() {
21    server.close();
22  });
23});
24