mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
test new detection of connection: upgrade
This commit is contained in:
parent
65a21bce6d
commit
ec683b924b
@ -59,6 +59,49 @@ describe('lib/http-proxy/common.js', function () {
|
||||
expect(outgoing.headers.connection).to.eql('upgrade');
|
||||
});
|
||||
|
||||
it('should not override agentless connection: contains upgrade', function () {
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing,
|
||||
{
|
||||
agent: undefined,
|
||||
target: {
|
||||
host : 'hey',
|
||||
hostname : 'how',
|
||||
socketPath: 'are',
|
||||
port : 'you',
|
||||
},
|
||||
headers: {'connection': 'keep-alive, upgrade'}, // this is what Firefox sets
|
||||
},
|
||||
{
|
||||
method : 'i',
|
||||
url : 'am',
|
||||
headers : {'pro':'xy','overwritten':false}
|
||||
});
|
||||
expect(outgoing.headers.connection).to.eql('keep-alive, upgrade');
|
||||
});
|
||||
|
||||
it('should override agentless connection: contains improper upgrade', function () {
|
||||
// sanity check on upgrade regex
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing,
|
||||
{
|
||||
agent: undefined,
|
||||
target: {
|
||||
host : 'hey',
|
||||
hostname : 'how',
|
||||
socketPath: 'are',
|
||||
port : 'you',
|
||||
},
|
||||
headers: {'connection': 'keep-alive, not upgrade'},
|
||||
},
|
||||
{
|
||||
method : 'i',
|
||||
url : 'am',
|
||||
headers : {'pro':'xy','overwritten':false}
|
||||
});
|
||||
expect(outgoing.headers.connection).to.eql('close');
|
||||
});
|
||||
|
||||
it('should override agentless non-upgrade header to close', function () {
|
||||
var outgoing = {};
|
||||
common.setupOutgoing(outgoing,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user