[test] passes/web.js XHeaders func

This commit is contained in:
cronopio 2013-08-26 00:21:30 -05:00
parent d40e4beb62
commit c02b721321

View File

@ -25,4 +25,21 @@ describe('lib/caronte/passes/web.js', function() {
expect(done).to.eql(5000);
});
});
describe('#XHeaders', function () {
var stubRequest = {
connection: {
remoteAddress: '192.168.1.2',
remotePort: '8080'
},
headers: {}
}
it('set the correct x-forwarded-* headers', function () {
caronte.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
});
});
});