From 52ecd52ee5aa78603e44ba8d5ff9187410351622 Mon Sep 17 00:00:00 2001 From: cronopio Date: Mon, 21 Oct 2013 03:59:14 -0500 Subject: [PATCH] [tests] fix test to use the new way to pass options --- lib/http-proxy/passes/web-incoming.js | 2 -- test/lib-http-proxy-passes-web-incoming-test.js | 6 +++--- test/lib-http-proxy-passes-ws-incoming-test.js | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/http-proxy/passes/web-incoming.js b/lib/http-proxy/passes/web-incoming.js index 03725710f..ca74bfff1 100644 --- a/lib/http-proxy/passes/web-incoming.js +++ b/lib/http-proxy/passes/web-incoming.js @@ -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'; } diff --git a/test/lib-http-proxy-passes-web-incoming-test.js b/test/lib-http-proxy-passes-web-incoming-test.js index 4269d5f8b..cd2bacd85 100644 --- a/test/lib-http-proxy-passes-web-incoming-test.js +++ b/test/lib-http-proxy-passes-web-incoming-test.js @@ -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'); diff --git a/test/lib-http-proxy-passes-ws-incoming-test.js b/test/lib-http-proxy-passes-ws-incoming-test.js index 87dfcef94..ee61234c6 100644 --- a/test/lib-http-proxy-passes-ws-incoming-test.js +++ b/test/lib-http-proxy-passes-ws-incoming-test.js @@ -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');