[tests] fix test to use the new way to pass options

This commit is contained in:
cronopio 2013-10-21 03:59:14 -05:00
parent 9b3e1eb247
commit 52ecd52ee5
3 changed files with 6 additions and 8 deletions

View File

@ -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';
}

View File

@ -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');

View File

@ -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');