mirror of https://github.com/lukechilds/node.git
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.
20 lines
535 B
20 lines
535 B
9 years ago
|
'use strict';
|
||
|
|
||
|
require('../common');
|
||
|
const assert = require('assert');
|
||
|
const http = require('http');
|
||
|
const https = require('https');
|
||
|
const error = 'Unable to determine the domain name';
|
||
|
|
||
|
function test(host) {
|
||
|
['get', 'request'].forEach((method) => {
|
||
|
[http, https].forEach((module) => {
|
||
|
assert.throws(() => module[method](host, () => {
|
||
|
throw new Error(`${module}.${method} should not connect to ${host}`);
|
||
|
}), error);
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
['www.nodejs.org', 'localhost', '127.0.0.1', 'http://:80/'].forEach(test);
|