mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[tests] fix test to use the new way to pass options
This commit is contained in:
parent
9b3e1eb247
commit
52ecd52ee5
@ -28,8 +28,6 @@ web_o = Object.keys(web_o).map(function(pass) {
|
||||
*/
|
||||
|
||||
function deleteLength(req, res) {
|
||||
// Now the options are stored on this
|
||||
var options = this.options;
|
||||
if(req.method === 'DELETE' && !req.headers['content-length']) {
|
||||
req.headers['content-length'] = '0';
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ describe('lib/http-proxy/passes/web.js', function() {
|
||||
method: 'DELETE',
|
||||
headers: {}
|
||||
};
|
||||
httpProxy.deleteLength(stubRequest, {}, {});
|
||||
httpProxy.deleteLength(stubRequest, {});
|
||||
expect(stubRequest.headers['content-length']).to.eql('0');
|
||||
})
|
||||
});
|
||||
@ -21,7 +21,7 @@ describe('lib/http-proxy/passes/web.js', function() {
|
||||
}
|
||||
}
|
||||
|
||||
httpProxy.timeout(stubRequest, {}, { timeout: 5000});
|
||||
httpProxy.timeout.call({ options: { timeout: 5000 }}, stubRequest, {});
|
||||
expect(done).to.eql(5000);
|
||||
});
|
||||
});
|
||||
@ -36,7 +36,7 @@ describe('lib/http-proxy/passes/web.js', function() {
|
||||
}
|
||||
|
||||
it('set the correct x-forwarded-* headers', function () {
|
||||
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
|
||||
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
|
||||
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
|
||||
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
|
||||
expect(stubRequest.headers['x-forwarded-proto']).to.be('http');
|
||||
|
||||
@ -107,7 +107,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
|
||||
|
||||
describe('#XHeaders', function () {
|
||||
it('return if no forward request', function () {
|
||||
var returnValue = httpProxy.XHeaders({}, {}, {});
|
||||
var returnValue = httpProxy.XHeaders.call({ options: {}}, {}, {});
|
||||
expect(returnValue).to.be(undefined);
|
||||
});
|
||||
|
||||
@ -119,7 +119,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
|
||||
},
|
||||
headers: {}
|
||||
}
|
||||
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
|
||||
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
|
||||
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.2');
|
||||
expect(stubRequest.headers['x-forwarded-port']).to.be('8080');
|
||||
expect(stubRequest.headers['x-forwarded-proto']).to.be('ws');
|
||||
@ -136,7 +136,7 @@ describe('lib/http-proxy/passes/ws-incoming.js', function () {
|
||||
},
|
||||
headers: {}
|
||||
};
|
||||
httpProxy.XHeaders(stubRequest, {}, { xfwd: true });
|
||||
httpProxy.XHeaders.call({ options: { xfwd: true }}, stubRequest, {});
|
||||
expect(stubRequest.headers['x-forwarded-for']).to.be('192.168.1.3');
|
||||
expect(stubRequest.headers['x-forwarded-port']).to.be('8181');
|
||||
expect(stubRequest.headers['x-forwarded-proto']).to.be('wss');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user