mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
027e1c706d
If socket creation failed then an error would be emitted on the client request object, but not 'close' nor would destroyed be set to true. PR-URL: https://github.com/nodejs/node/pull/33178 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
22 lines
467 B
JavaScript
22 lines
467 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const http = require('http');
|
|
|
|
const agent = new http.Agent();
|
|
const _err = new Error('kaboom');
|
|
agent.createSocket = function(req, options, cb) {
|
|
cb(_err);
|
|
};
|
|
|
|
const req = http
|
|
.request({
|
|
agent
|
|
})
|
|
.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err, _err);
|
|
}))
|
|
.on('close', common.mustCall(() => {
|
|
assert.strictEqual(req.destroyed, true);
|
|
}));
|