Removing Current

This commit is contained in:
Luis Fernando Molina committed 2020-11-20 14:17:04 +01:00
1 parent d6c5e91290
commit a4ed878fcd
4379 files changed

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
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
}
+23
View File
@@ -0,0 +1,23 @@
{
"name": "http-https",
"version": "1.0.0",
"description": "A wrapper that chooses http or https for requests",
"main": "http-https.js",
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/http-https"
},
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "ISC",
"bugs": {
"url": "https://github.com/isaacs/http-https/issues"
},
"homepage": "https://github.com/isaacs/http-https"
,"_resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz"
,"_integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs="
,"_from": "http-https@^1.0.0"
}
+6
View File
@@ -0,0 +1,6 @@
var hh = require('./http-https.js')
var assert = require('assert')
assert.equal(hh.getModule('https://foo'), hh.https)
assert.equal(hh.getModule('http://foo'), hh.http)
console.log('ok')