File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,16 @@ const PROXY_TYPES = ['http', 'lambda']
15
15
const registerWebSocketRoutes = require ( './lib/ws-proxy' )
16
16
17
17
const gateway = ( opts ) => {
18
- const proxyFactory = opts . proxyFactory ? ( ...args ) => ( ( r ) => r === undefined ? defaultProxyFactory ( ...args ) : r ) ( opts . proxyFactory ( ...args ) ) : defaultProxyFactory
18
+ let proxyFactory
19
+
20
+ if ( opts . proxyFactory ) {
21
+ proxyFactory = ( ...args ) => {
22
+ const result = opts . proxyFactory ( ...args )
23
+ return result === undefined ? defaultProxyFactory ( ...args ) : result
24
+ }
25
+ } else {
26
+ proxyFactory = defaultProxyFactory
27
+ }
19
28
20
29
opts = Object . assign (
21
30
{
@@ -76,7 +85,9 @@ const gateway = (opts) => {
76
85
}
77
86
78
87
// retrieve default hooks for proxy
79
- const hooksForDefaultType = isDefaultProxyType ? require ( './lib/default-hooks' ) [ proxyType ] : { }
88
+ const hooksForDefaultType = isDefaultProxyType
89
+ ? require ( './lib/default-hooks' ) [ proxyType ]
90
+ : { }
80
91
const { onRequestNoOp = NOOP , onResponse = NOOP } = hooksForDefaultType
81
92
82
93
// populating required NOOPS
You can’t perform that action at this time.
0 commit comments