1/* eslint-disable node-core/crypto-check */ 2 3'use strict'; 4 5const common = require('../common'); 6 7const http = require('http'); 8const modules = { http }; 9 10const deprecations = [ 11 ['The provided URL http://[www.nodejs.org] is not a valid URL, and is supported ' + 12 'in the http module solely for compatibility.', 13 'DEP0109'], 14]; 15 16if (common.hasCrypto) { 17 const https = require('https'); 18 modules.https = https; 19 deprecations.push( 20 ['The provided URL https://[www.nodejs.org] is not a valid URL, and is supported ' + 21 'in the https module solely for compatibility.', 22 'DEP0109'], 23 ); 24} 25 26common.expectWarning('DeprecationWarning', deprecations); 27 28Object.keys(modules).forEach((module) => { 29 const doNotCall = common.mustNotCall( 30 `${module}.request should not connect to ${module}://[www.nodejs.org]` 31 ); 32 modules[module].request(`${module}://[www.nodejs.org]`, doNotCall).abort(); 33}); 34