Skip to content

Commit

Permalink
[tests] fix tests set correct host headers
Browse files Browse the repository at this point in the history
  • Loading branch information
cronopio committed Dec 18, 2013
1 parent c4d56a5 commit cfd417d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 7 additions & 5 deletions test/lib-http-proxy-passes-web-incoming-test.js
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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();
});
Expand All @@ -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();
});
Expand Down
8 changes: 6 additions & 2 deletions test/lib-http-proxy-passes-ws-incoming-test.js
Expand Up @@ -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');
Expand All @@ -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');
Expand Down

0 comments on commit cfd417d

Please sign in to comment.