express-http-proxy
Advanced tools
Comparing version 0.7.0 to 0.7.1
35
index.js
@@ -21,22 +21,9 @@ var assert = require('assert'); | ||
if (typeof host == 'string') { | ||
var mc = host.match(/^(https?:\/\/)/); | ||
if (mc) { | ||
host = host.substring(mc[1].length); | ||
} | ||
var parsedHost = null; | ||
if (typeof host != 'function') { | ||
parsedHost = parseHost(host.toString()); | ||
if (isError(parsedHost)) | ||
throw parsedHost; | ||
} | ||
var h = host.split(':'); | ||
if (h[1] === '443') { | ||
ishttps = true; | ||
} | ||
host = h[0]; | ||
port = h[1] || (ishttps ? 443 : 80); | ||
port = String.prototype.replace.call(port, '/', ''); | ||
} else { | ||
port = ishttps ? 443 : 80; | ||
} | ||
port = options.port || port; | ||
/** | ||
@@ -68,5 +55,7 @@ * intercept(targetResponse, data, res, req, function(err, json)); | ||
var parsedHost = parseHost((typeof host == 'function') ? host(req) : host.toString()); | ||
if (isError(parsedHost)) | ||
next(parsedHost); | ||
if (!parsedHost) { | ||
parsedHost = parseHost((typeof host == 'function') ? host(req) : host.toString()); | ||
if (isError(parsedHost)) | ||
throw parsedHost; | ||
} | ||
@@ -106,3 +95,3 @@ // var hasRequestBody = 'content-type' in req.headers || 'transfer-encoding' in req.headers; | ||
delete reqOpt.params; | ||
if (err && !bodyContent) return next(err); | ||
@@ -109,0 +98,0 @@ |
{ | ||
"name": "express-http-proxy", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "http proxy middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -39,3 +39,3 @@ var assert = require('assert'); | ||
var https = express(); | ||
https.use( proxy(function() { return 'httpbin.org'; }, {https: true}) ); | ||
https.use(proxy(function() { return 'httpbin.org'; }, {https: true}) ); | ||
request(https) | ||
@@ -42,0 +42,0 @@ .get('/user-agent') |
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
20151
483