Skip to content

Commit

Permalink
[fix] closes #553
Browse files Browse the repository at this point in the history
  • Loading branch information
yawnt committed Jan 17, 2014
1 parent 3330e12 commit 53a2653
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/http-proxy/index.js
Expand Up @@ -26,9 +26,15 @@ httpProxy.Server = ProxyServer;
*/

function createRightProxy(type) {
var webPasses = Object.keys(web).map(function(pass) {
return web[pass];
});
var wsPasses = Object.keys(ws).map(function(pass) {
return ws[pass];
});
return function(options) {
return function(req, res /*, [head], [opts] */) {
var passes = (type === 'ws') ? this.wsPasses : this.webPasses,
var passes = (type === 'ws') ? (this.wsPasses || wsPasses) : (this.webPasses || webPasses),
args = [].slice.call(arguments),
cntr = args.length - 1,
head, cbl;
Expand Down Expand Up @@ -62,7 +68,8 @@ function createRightProxy(type) {
if (typeof options[e] === 'string')
options[e] = parse_url(options[e]);
});


if(typeof this.emit == 'undefined' && !cbl) { throw new Error("You need to pass a callback to handle errors") }

for(var i=0; i < passes.length; i++) {
/**
Expand Down

0 comments on commit 53a2653

Please sign in to comment.