[tests] fix tests set correct host headers

This commit is contained in:
cronopio 2013-12-18 12:17:41 -05:00
parent c4d56a5faf
commit cfd417de23
2 changed files with 13 additions and 7 deletions

View File

@ -34,7 +34,9 @@ describe('lib/http-proxy/passes/web.js', function() {
remoteAddress: '192.168.1.2',
remotePort: '8080'
},
headers: {}
headers: {
host: '192.168.1.2:8080'
}
}
it('set the correct x-forwarded-* headers', function () {
@ -88,11 +90,11 @@ describe('#createProxyServer.web() using own http server', function () {
});
}
proxyServer.listen('8081');
proxyServer.listen('8082');
http.request({
hostname: '127.0.0.1',
port: '8081',
port: '8082',
method: 'GET',
}, function() {}).end();
});
@ -117,11 +119,11 @@ describe('#createProxyServer.web() using own http server', function () {
proxy.web(req, res);
}
proxyServer.listen('8081');
proxyServer.listen('8083');
http.request({
hostname: '127.0.0.1',
port: '8081',
port: '8083',
method: 'GET',
}, function() {}).end();
});

View File

@ -88,7 +88,9 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
remoteAddress: '192.168.1.2',
remotePort: '8080'
},
headers: {}
headers: {
host: '192.168.1.2:8080'
}
}
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
@ -105,7 +107,9 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
connection: {
pair: true
},
headers: {}
headers: {
host: '192.168.1.3:8181'
}
};
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');