11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst http = require('http'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst uncaughtCallback = common.mustCall(function(er) { 81cb0ef41Sopenharmony_ci assert.strictEqual(er.message, 'get did fail'); 91cb0ef41Sopenharmony_ci}); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciprocess.on('uncaughtException', uncaughtCallback); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst server = http.createServer(function(req, res) { 141cb0ef41Sopenharmony_ci res.writeHead(200, { 'Content-Type': 'text/plain' }); 151cb0ef41Sopenharmony_ci res.end('bye'); 161cb0ef41Sopenharmony_ci}).listen(0, function() { 171cb0ef41Sopenharmony_ci http.get({ port: this.address().port }, function(res) { 181cb0ef41Sopenharmony_ci res.resume(); 191cb0ef41Sopenharmony_ci throw new Error('get did fail'); 201cb0ef41Sopenharmony_ci }).on('close', function() { 211cb0ef41Sopenharmony_ci server.close(); 221cb0ef41Sopenharmony_ci }); 231cb0ef41Sopenharmony_ci}); 24