发布时间:2019-02-19编辑:佚名阅读(5740)
方法一:
var http = require('http'); var https = require('https'); var protocol = (parsedUrl.protocol == 'https:' ? https : http); protocol.get(parsedUrl, function(res) { ... });
方法二:
var adapterFor = (function() { var url = require('url'), adapters = { 'http:': require('http'), 'https:': require('https'), }; return function(inputUrl) { return adapters[url.parse(inputUrl).protocol] } }()); adapterFor(url).get(url, ...)
关键字: Protocol https not supported Expected http
上一篇:8P主板用4P电源
0人
0人
0人
3人