mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
commit
aa8f3e9a6e
@ -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);
|
||||
|
||||
@ -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 () {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user