Skip to content

Commit

Permalink
[test] passes/web.js XHeaders func
Browse files Browse the repository at this point in the history
  • Loading branch information
cronopio committed Aug 26, 2013
1 parent d40e4be commit c02b721
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/lib-caronte-passes-web-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
});

0 comments on commit c02b721

Please sign in to comment.