2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-05-29 03:06:56 -04:00
|
|
|
require('../common');
|
2011-11-03 01:20:54 +01:00
|
|
|
var http = require('http');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
|
|
assert(false); // should not be called
|
|
|
|
});
|
|
|
|
|
2016-05-29 03:06:56 -04:00
|
|
|
server.listen(0, function() {
|
|
|
|
var req = http.request({
|
|
|
|
method: 'GET',
|
|
|
|
host: '127.0.0.1',
|
|
|
|
port: this.address().port
|
|
|
|
});
|
2011-11-03 01:20:54 +01:00
|
|
|
|
|
|
|
req.on('error', function(ex) {
|
|
|
|
// https://github.com/joyent/node/issues/1399#issuecomment-2597359
|
|
|
|
// abort() should emit an Error, not the net.Socket object
|
|
|
|
assert(ex instanceof Error);
|
|
|
|
});
|
|
|
|
|
|
|
|
req.abort();
|
|
|
|
req.end();
|
|
|
|
|
|
|
|
server.close();
|
|
|
|
});
|