Skip to content

Commit cfd417d

Browse files
committed
[tests] fix tests set correct host headers
1 parent c4d56a5 commit cfd417d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

test/lib-http-proxy-passes-web-incoming-test.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ describe('lib/http-proxy/passes/web.js', function() {
3434
remoteAddress: '192.168.1.2',
3535
remotePort: '8080'
3636
},
37-
headers: {}
37+
headers: {
38+
host: '192.168.1.2:8080'
39+
}
3840
}
3941

4042
it('set the correct x-forwarded-* headers', function () {
@@ -88,11 +90,11 @@ describe('#createProxyServer.web() using own http server', function () {
8890
});
8991
}
9092

91-
proxyServer.listen('8081');
93+
proxyServer.listen('8082');
9294

9395
http.request({
9496
hostname: '127.0.0.1',
95-
port: '8081',
97+
port: '8082',
9698
method: 'GET',
9799
}, function() {}).end();
98100
});
@@ -117,11 +119,11 @@ describe('#createProxyServer.web() using own http server', function () {
117119
proxy.web(req, res);
118120
}
119121

120-
proxyServer.listen('8081');
122+
proxyServer.listen('8083');
121123

122124
http.request({
123125
hostname: '127.0.0.1',
124-
port: '8081',
126+
port: '8083',
125127
method: 'GET',
126128
}, function() {}).end();
127129
});

test/lib-http-proxy-passes-ws-incoming-test.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
8888
remoteAddress: '192.168.1.2',
8989
remotePort: '8080'
9090
},
91-
headers: {}
91+
headers: {
92+
host: '192.168.1.2:8080'
93+
}
9294
}
9395
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
9496
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 () {
105107
connection: {
106108
pair: true
107109
},
108-
headers: {}
110+
headers: {
111+
host: '192.168.1.3:8181'
112+
}
109113
};
110114
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
111115
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');

0 commit comments

Comments
 (0)