Merge pull request #798 from damonmcminn/master

Fix #747
This commit is contained in:
Jarrett Cruger 2015-04-01 11:07:42 -04:00
commit aa8f3e9a6e
2 changed files with 12 additions and 1 deletions

View File

@ -80,7 +80,7 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
// Remark: Can we somehow not use url.parse as a perf optimization?
//
var outgoingPath = !options.toProxy
? url.parse(req.url).path
? (url.parse(req.url).path || '/')
: req.url;
outgoing.path = common.urlJoin(targetPath, outgoingPath);

View File

@ -299,6 +299,17 @@ describe('lib/http-proxy/common.js', function () {
expect(outgoing.ciphers).eql('my-ciphers');
expect(outgoing.secureProtocol).eql('my-secure-protocol');
});
// url.parse('').path => null
it('should not pass null as last arg to #urlJoin', function(){
var outgoing = {};
common.setupOutgoing(outgoing, {target:
{ path: '' }
}, { url : '' });
expect(outgoing.path).to.be('/');
});
});
describe('#setupSocket', function () {