bagofholding
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,2 +0,5 @@ | ||
### 0.1.5-pre | ||
### 0.1.6-pre | ||
* Add http#req no proxy hosts handling, localhost and 127.0.0 will ignore proxy by default | ||
### 0.1.5 | ||
* Add http#req timeout handling, default timeout changed to 2000 milliseconds | ||
@@ -3,0 +6,0 @@ |
/*jshint esnext: true */ | ||
var request = require('request'); | ||
var request = require('request'), | ||
_url = require('url'); | ||
@@ -14,2 +15,3 @@ /** | ||
* - proxy: proxy server URL with format http://user:pass@host:port | ||
* - noProxyHosts: an array of host names which will ignore any proxy settings, defaults to: localhost, 127.0.0.1 | ||
* - queryStrings: object containing URL query strings with format { name: value } | ||
@@ -31,7 +33,14 @@ * - handlers: response handlers with format { statuscode: function(result, cb) } | ||
function _proxyIgnored() { | ||
const NO_PROXY_HOSTS = ['localhost', '127.0.0.1']; | ||
return (opts.noProxyHosts || NO_PROXY_HOSTS).indexOf(_url.parse(url).hostname) !== -1; | ||
} | ||
// set proxy setting based on environment variable | ||
if (opts.proxy) { | ||
params.proxy = opts.proxy; | ||
} else if (envProxy) { | ||
params.proxy = envProxy; | ||
if (!_proxyIgnored()) { | ||
if (opts.proxy) { | ||
params.proxy = opts.proxy; | ||
} else if (envProxy) { | ||
params.proxy = envProxy; | ||
} | ||
} | ||
@@ -38,0 +47,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"keywords": [], | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"homepage": "http://github.com/cliffano/bagofholding", | ||
@@ -8,0 +8,0 @@ "author": "Cliffano Subagio <blah@cliffano.com> (http://blog.cliffano.com)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19393
382