express-http-proxy
Advanced tools
Comparing version 0.5.0 to 0.6.0
12
index.js
@@ -34,2 +34,3 @@ var assert = require('assert'); | ||
port = h[1] || (ishttps ? 443 : 80); | ||
port = String.prototype.replace.call(port, '/', ''); | ||
} | ||
@@ -48,2 +49,3 @@ | ||
var limit = options.limit || '1mb'; | ||
var preserveHostHdr = options.preserveHostHdr; | ||
@@ -58,3 +60,7 @@ return function handleProxy(req, res, next) { | ||
var hds = extend(headers, req.headers, ['connection', 'host', 'content-length']); | ||
var skipHdrs = [ 'connection', 'content-length' ]; | ||
if (!preserveHostHdr) { | ||
skipHdrs.push('host'); | ||
} | ||
var hds = extend(headers, req.headers, skipHdrs); | ||
hds.connection = 'close'; | ||
@@ -75,3 +81,4 @@ | ||
path: path, | ||
bodyContent: bodyContent | ||
bodyContent: bodyContent, | ||
params: req.params | ||
}; | ||
@@ -85,2 +92,3 @@ | ||
delete reqOpt.bodyContent; | ||
delete reqOpt.params; | ||
@@ -87,0 +95,0 @@ if (typeof bodyContent == 'string') |
{ | ||
"name": "express-http-proxy", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "http proxy middleware for express", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,3 @@ var assert = require('assert'); | ||
}); | ||
describe('test https', function() { | ||
@@ -124,3 +124,3 @@ it('https', function(done) { | ||
})); | ||
request(app) | ||
@@ -242,2 +242,29 @@ .get('/html') | ||
describe('test url parsing', function() { | ||
it('can parse a url with a port', function(done) { | ||
var app = express(); | ||
app.use(proxy('http://localhost:9786')); | ||
request(app) | ||
.get('/') | ||
.end(function(err, res) { | ||
if (err) return done(err); | ||
assert(true); | ||
done(); | ||
}); | ||
}); | ||
it('does not throw `Uncaught RangeError` if you have both a port and a trailing slash', function(done) { | ||
var app = express(); | ||
app.use(proxy('http://localhost:9786/')); | ||
request(app) | ||
.get('/') | ||
.end(function(err, res) { | ||
if (err) return done(err); | ||
assert(true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
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
16566
387