Skip to content

Commit 52ecd52

Browse files
committed
[tests] fix test to use the new way to pass options
1 parent 9b3e1eb commit 52ecd52

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

Diff for: lib/http-proxy/passes/web-incoming.js

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ web_o = Object.keys(web_o).map(function(pass) {
2828
*/
2929

3030
function deleteLength(req, res) {
31-
// Now the options are stored on this
32-
var options = this.options;
3331
if(req.method === 'DELETE' && !req.headers['content-length']) {
3432
req.headers['content-length'] = '0';
3533
}

Diff for: test/lib-http-proxy-passes-web-incoming-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('lib/http-proxy/passes/web.js', function() {
88
method: 'DELETE',
99
headers: {}
1010
};
11-
httpProxy.deleteLength(stubRequest, {}, {});
11+
httpProxy.deleteLength(stubRequest, {});
1212
expect(stubRequest.headers['content-length']).to.eql('0');
1313
})
1414
});
@@ -21,7 +21,7 @@ describe('lib/http-proxy/passes/web.js', function() {
2121
}
2222
}
2323

24-
httpProxy.timeout(stubRequest, {}, { timeout: 5000});
24+
httpProxy.timeout.call({ options: { timeout: 5000 }}, stubRequest, {});
2525
expect(done).to.eql(5000);
2626
});
2727
});
@@ -36,7 +36,7 @@ describe('lib/http-proxy/passes/web.js', function() {
3636
}
3737

3838
it('set the correct x-forwarded-* headers', function () {
39-
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
39+
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
4040
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
4141
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
4242
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');

Diff for: test/lib-http-proxy-passes-ws-incoming-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
107107

108108
describe('#XHeaders', function () {
109109
it('return if no forward request', function () {
110-
var returnValue = httpProxy.XHeaders({}, {}, {});
110+
var returnValue = httpProxy.XHeaders.call({ options: {}}, {}, {});
111111
expect(returnValue).to.be(undefined);
112112
});
113113

@@ -119,7 +119,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
119119
},
120120
headers: {}
121121
}
122-
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
122+
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
123123
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
124124
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
125125
expect(stubRequest.headers['x-forwarded-proto']).to.be('ws');
@@ -136,7 +136,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
136136
},
137137
headers: {}
138138
};
139-
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
139+
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
140140
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');
141141
expect(stubRequest.headers['x-forwarded-port']).to.be('8181');
142142
expect(stubRequest.headers['x-forwarded-proto']).to.be('wss');

0 commit comments

Comments
 (0)