mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
copy headers instead of referencing them so they don't unexpectedly get overwritten
This commit is contained in:
parent
69a693034e
commit
daa2ce0ee3
@ -31,9 +31,8 @@ common.setupOutgoing = function(outgoing, options, req, forward) {
|
||||
function(e) { outgoing[e] = options[forward || 'target'][e]; }
|
||||
);
|
||||
|
||||
['method', 'headers'].forEach(
|
||||
function(e) { outgoing[e] = req[e]; }
|
||||
);
|
||||
outgoing.method = req.method
|
||||
outgoing.headers = extend({},req.headers)
|
||||
|
||||
if (options.headers){
|
||||
extend(outgoing.headers, options.headers);
|
||||
|
||||
@ -146,7 +146,7 @@ describe('lib/http-proxy/common.js', function () {
|
||||
{
|
||||
method : 'i',
|
||||
url : 'am',
|
||||
headers : 'proxy'
|
||||
headers : {pro:'xy'}
|
||||
});
|
||||
|
||||
expect(outgoing.host).to.eql('how');
|
||||
@ -156,7 +156,7 @@ describe('lib/http-proxy/common.js', function () {
|
||||
|
||||
expect(outgoing.method).to.eql('i');
|
||||
expect(outgoing.path).to.eql('am');
|
||||
expect(outgoing.headers).to.eql('proxy')
|
||||
expect(outgoing.headers.pro).to.eql('xy')
|
||||
|
||||
expect(outgoing.port).to.eql(443);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user