Skip to content

Commit c02b721

Browse files
committed
[test] passes/web.js XHeaders func
1 parent d40e4be commit c02b721

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/lib-caronte-passes-web-test.js

+17
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,21 @@ describe('lib/caronte/passes/web.js', function() {
2525
expect(done).to.eql(5000);
2626
});
2727
});
28+
29+
describe('#XHeaders', function () {
30+
var stubRequest = {
31+
connection: {
32+
remoteAddress: '192.168.1.2',
33+
remotePort: '8080'
34+
},
35+
headers: {}
36+
}
37+
38+
it('set the correct x-forwarded-* headers', function () {
39+
caronte.XHeaders(stubRequest, {}, { xfwd: true });
40+
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
41+
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
42+
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
43+
});
44+
});
2845
});

0 commit comments

Comments
 (0)