mirror of https://github.com/lukechilds/node.git
Browse Source
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>v7.x
Juwan Yoo
8 years ago
committed by
Italo A. Casas
2 changed files with 29 additions and 15 deletions
@ -0,0 +1,20 @@ |
|||
'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()); |
|||
})); |
Loading…
Reference in new issue