You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
690 B

/* eslint-disable crypto-check */
'use strict';
const common = require('../common');
const http = require('http');
const modules = { 'http': http };
if (common.hasCrypto) {
const https = require('https');
modules.https = https;
}
function test(host) {
['get', 'request'].forEach((fn) => {
Object.keys(modules).forEach((module) => {
const doNotCall = common.mustNotCall(
`${module}.${fn} should not connect to ${host}`
);
const throws = () => { modules[module][fn](host, doNotCall); };
common.expectsError(throws, { code: 'ERR_INVALID_DOMAIN_NAME' });
});
});
}
['www.nodejs.org', 'localhost', '127.0.0.1', 'http://:80/'].forEach(test);