Skip to content

Commit 37036dd

Browse files
committed
[fix] emit an error if proper URL is not passed in as a target
1 parent 63c53a1 commit 37036dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: lib/http-proxy/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function createRightProxy(type) {
6464
options[e] = parse_url(options[e]);
6565
});
6666

67-
if(typeof this.emit === 'undefined' && !cbl) { throw new Error("You need to pass a callback to handle errors") }
67+
if (!options.target && !options.forward) {
68+
return this.emit('error', new Error('Must provide a proper URL as target'));
69+
}
6870

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

0 commit comments

Comments
 (0)