File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,15 @@ httpProxy.Server = ProxyServer;
26
26
*/
27
27
28
28
function createRightProxy ( type ) {
29
+ var webPasses = Object . keys ( web ) . map ( function ( pass ) {
30
+ return web [ pass ] ;
31
+ } ) ;
32
+ var wsPasses = Object . keys ( ws ) . map ( function ( pass ) {
33
+ return ws [ pass ] ;
34
+ } ) ;
29
35
return function ( options ) {
30
36
return function ( req , res /*, [head], [opts] */ ) {
31
- var passes = ( type === 'ws' ) ? this . wsPasses : this . webPasses ,
37
+ var passes = ( type === 'ws' ) ? ( this . wsPasses || wsPasses ) : ( this . webPasses || webPasses ) ,
32
38
args = [ ] . slice . call ( arguments ) ,
33
39
cntr = args . length - 1 ,
34
40
head , cbl ;
@@ -62,7 +68,8 @@ function createRightProxy(type) {
62
68
if ( typeof options [ e ] === 'string' )
63
69
options [ e ] = parse_url ( options [ e ] ) ;
64
70
} ) ;
65
-
71
+
72
+ if ( typeof this . emit == 'undefined' && ! cbl ) { throw new Error ( "You need to pass a callback to handle errors" ) }
66
73
67
74
for ( var i = 0 ; i < passes . length ; i ++ ) {
68
75
/**
You can’t perform that action at this time.
0 commit comments