aozhiwei 0a973d12e3 1
2022-01-27 17:32:21 +08:00

20 lines
422 B
JavaScript

var http = exports.http = require('http')
var https = exports.https = require('https')
var url = require('url')
exports.get = function(opt, cb) {
return getMod(opt).get(opt, cb)
}
exports.request = function(opt, cb) {
return getMod(opt).request(opt, cb)
}
exports.getModule = getMod
function getMod(opt) {
if (typeof opt === 'string')
opt = url.parse(opt)
return opt.protocol === 'https:' ? https : http
}