diff --git a/lib/http-proxy/index.js b/lib/http-proxy/index.js index 2e8d212ae..29533d170 100644 --- a/lib/http-proxy/index.js +++ b/lib/http-proxy/index.js @@ -64,7 +64,9 @@ function createRightProxy(type) { options[e] = parse_url(options[e]); }); - if(typeof this.emit === 'undefined' && !cbl) { throw new Error("You need to pass a callback to handle errors") } + if (!options.target && !options.forward) { + return this.emit('error', new Error('Must provide a proper URL as target')); + } for(var i=0; i < passes.length; i++) { /**