@metreeca/http - v0.1.1
    Preparing search index...

    Function createFetch

    • Creates a fetch client from a chain of middlewares.

      Layers middlewares over the standard fetch function in declaration order: requests are processed by the first middleware first and reach the standard function last; responses travel back through the chain in reverse. An empty chain yields the standard function itself.

      The standard function is resolved when the chain is assembled, so a client routes through a global replaced before its creation, such as a test double or a polyfill installed at start-up, but not through one replaced afterwards. To bind a client to an implementation of its own, regardless of the global one, close the chain with transport.

      Parameters

      • ...middlewares: readonly Middleware[]

        The middlewares to be layered over the standard fetch function, in request processing order

      Returns {
          (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
          (input: string | Request | URL, init?: RequestInit): Promise<Response>;
      }

      A drop-in replacement for the standard fetch function routing every exchange through middlewares

        • (input: RequestInfo | URL, init?: RequestInit): Promise<Response>
        • Parameters

          • input: RequestInfo | URL
          • Optionalinit: RequestInit

          Returns Promise<Response>

        • (input: string | Request | URL, init?: RequestInit): Promise<Response>
        • Parameters

          • input: string | Request | URL
          • Optionalinit: RequestInit

          Returns Promise<Response>