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']
1515const registerWebSocketRoutes = require ( './lib/ws-proxy' )
1616
1717const 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+ }
1928
2029 opts = Object . assign (
2130 {
@@ -76,7 +85,9 @@ const gateway = (opts) => {
7685 }
7786
7887 // 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+ : { }
8091 const { onRequestNoOp = NOOP , onResponse = NOOP } = hooksForDefaultType
8192
8293 // populating required NOOPS
You can’t perform that action at this time.
0 commit comments