mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
c6cbbf9263
Arguments of Socket.prototype.connect should be also normalized, causing error when called without callback. Changed Socket.prototype.connect's code same as net.connect and added test. Fixes: https://github.com/nodejs/node/issues/11761 PR-URL: https://github.com/nodejs/node/pull/11762 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
21 lines
471 B
JavaScript
21 lines
471 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// This test ensures that socket.connect can be called without callback
|
|
// which is optional.
|
|
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(common.mustCall(function(conn) {
|
|
conn.end();
|
|
server.close();
|
|
})).listen(0, common.mustCall(function() {
|
|
const client = new net.Socket();
|
|
|
|
client.on('connect', common.mustCall(function() {
|
|
client.end();
|
|
}));
|
|
|
|
client.connect(server.address());
|
|
}));
|