diff --git a/test/lib-caronte-passes-web-test.js b/test/lib-caronte-passes-web-test.js index b814612ed..4ec5ca1a2 100644 --- a/test/lib-caronte-passes-web-test.js +++ b/test/lib-caronte-passes-web-test.js @@ -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'); + }); + }); });