We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c271b1 commit 4762f4aCopy full SHA for 4762f4a
2 files changed
lib/net.js
@@ -1311,6 +1311,8 @@ function lookupAndConnect(self, options) {
1311
const host = options.host || 'localhost';
1312
let { port, autoSelectFamilyAttemptTimeout, autoSelectFamily } = options;
1313
1314
+ validateString(host, 'options.host');
1315
+
1316
if (localAddress && !isIP(localAddress)) {
1317
throw new ERR_INVALID_IP_ADDRESS(localAddress);
1318
}
test/parallel/test-net-connect-options-invalid.js
@@ -25,3 +25,15 @@ const net = require('net');
25
});
26
27
28
29
+{
30
+ assert.throws(() => {
31
+ net.createConnection({
32
+ host: ['192.168.0.1'],
33
+ port: 8080,
34
+ });
35
+ }, {
36
+ code: 'ERR_INVALID_ARG_TYPE',
37
+ name: 'TypeError',
38
39
+}
0 commit comments