Add more xfwd tests (https+http & http+https)

This commit is contained in:
Rob Wu
2015-05-06 18:20:11 +02:00
parent 056cb446fe
commit e8202aa31f

View File

@@ -236,6 +236,18 @@ describe('Basic functionality', function() {
}, done);
});
it('X-Forwarded-* headers (https)', function(done) {
request(cors_anywhere)
.get('/https://example.com/echoheaders')
.set('test-include-xfwd', '')
.expect('Access-Control-Allow-Origin', '*')
.expectJSON({
host: 'example.com',
'x-forwarded-port': '80',
'x-forwarded-proto': 'http',
}, done);
});
it('Ignore cookies', function(done) {
request(cors_anywhere)
.get('/example.com/setcookie')
@@ -275,6 +287,18 @@ describe('server on https', function() {
stopServer(done);
});
it('X-Forwarded-* headers (http)', function(done) {
request(cors_anywhere)
.get('/example.com/echoheaders')
.set('test-include-xfwd', '')
.expect('Access-Control-Allow-Origin', '*')
.expectJSON({
host: 'example.com',
'x-forwarded-port': '443',
'x-forwarded-proto': 'https',
}, done);
});
it('X-Forwarded-* headers (https)', function(done) {
request(cors_anywhere)
.get('/https://example.com/echoheaders')