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; to answer exchanges locally, without a backend, close it with
mock.
Creates a fetch client from a chain of middlewares.
Layers
middlewaresover the standardfetchfunction 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; to answer exchanges locally, without a backend, close it with mock.