Skip to content

Commit

Permalink
[tests] fix test to use the new way to pass options
Browse files Browse the repository at this point in the history
  • Loading branch information
cronopio committed Oct 21, 2013
1 parent 9b3e1eb commit 52ecd52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions lib/http-proxy/passes/web-incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
6 changes: 3 additions & 3 deletions test/lib-http-proxy-passes-web-incoming-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
})
});
Expand All @@ -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);
});
});
Expand All @@ -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');
Expand Down
6 changes: 3 additions & 3 deletions test/lib-http-proxy-passes-ws-incoming-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

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

0 comments on commit 52ecd52

Please sign in to comment.