http-s
A Node module to load the http or https module accordingly to the protocol name
var httpOrHttps = ; ; // equivalent of `require('http')`; // equivalent of `require('https')`; // equivalent of `require('http')`
Installation
npm
npm install http-s
bower
bower install http-s
API
var httpOrHttps = ;
httpOrHttps(urlObject)
urlObject: Object
(which has protocol
property)
Return: http or https
It returns http module if the protocol
property is "http:"
, or returns https module if the property is "https:"
.
; //=> https var url = ;var options = url;// => {protocol: 'http:', slashes: true, auth: null, ...} ; //=> http
httpOrHttps(urlString)
urlString: String
Return: http or https
When it takes a string as an argument instead of an object, it automatically parses the string with url.parse()
.
; //=> http
License
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT License.