_composePlugins(funcs) {
    if (funcs.length === 0) {
      return () => ({ get: () => null });
    }

    return funcs.reduce((a, b) => async request => {
      const x = await a(request);
      let response = await x.get();
      if (response) {
        // pass response to put method
        if (x.put) {
          await x.put(response)
        }

        return {
          get: () => response,
        };
      }

      const y = await b(request);
      response = await y.get();

      return {
        get: () => response,
        put: this._composeHandlers(y.put, x.put)
      };
    });
  }
// Call put method for previous middleware with given response
Call put method for previous middleware with given response
Call put method for previous middleware with given response
_composePlugins(funcs) {
    if (funcs.length === 0) {
      return () => ({ get: () => null });
    }
    return funcs.reduce((a, b) => async request => {
      const x = await a(request);
      let response = await x.get();
      if (response) {
        if (x.put) {
          await x.put(response)
        }
        return {
          get: () => response,
        };
      }
      const y = await b(request);
      response = await y.get();
      return {
        get: () => response,
        put: this._composeHandlers(y.put, x.put)
      };
    });
  }
_composePlugins ( funcs ) { if ( funcs . length === 0 ) { return ( ) => ( { get : ( ) => null } ) ; } return funcs . reduce ( ( a , b ) => async request => { const x = await a ( request ) ; let response = await x . get ( ) ; if ( response ) { if ( x . put ) { await x . put ( response ) } return { get : ( ) => response , } ; } const y = await b ( request ) ; response = await y . get ( ) ; return { get : ( ) => response , put : this . _composeHandlers ( y . put , x . put ) } ; } ) ; }
Call put method for previous middleware with given response
Call put method for previous middleware with given response
// pass response to put method