From 37036dd32565f72ad5777e47509293db18b60ed3 Mon Sep 17 00:00:00 2001 From: Jarrett Cruger Date: Thu, 14 Aug 2014 13:32:32 -0400 Subject: [PATCH] [fix] emit an error if proper URL is not passed in as a target --- lib/http-proxy/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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++) { /**