Skip to content

Commit 2bf20d6

Browse files
committed
Revert "[tests] fix test to use the new way to pass options"
This reverts commit 52ecd52.
1 parent 52ecd52 commit 2bf20d6

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ 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;
3133
if(req.method === 'DELETE' && !req.headers['content-length']) {
3234
req.headers['content-length'] = '0';
3335
}

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.call({ options: { timeout: 5000 }}, stubRequest, {});
24+
httpProxy.timeout(stubRequest, {}, { timeout: 5000});
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.call({ options: { xfwd: true }}, stubRequest, {});
39+
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
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');

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.call({ options: {}}, {}, {});
110+
var returnValue = httpProxy.XHeaders({}, {}, {});
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.call({ options: { xfwd: true }}, stubRequest, {});
122+
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
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.call({ options: { xfwd: true }}, stubRequest, {});
139+
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
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)