Composes an array of middlewares into a single wrapper around a FetchLike function.
Middlewares are applied in array order — the first middleware is the outermost wrapper (executes first on the way in, last on the way out).
An array of middleware functions to compose.
The inner fetch implementation to wrap.
A FetchLike function that runs through the full middleware chain.
const enhanced = composeMiddleware([retry(), timeout()], globalThis.fetch);const response = await enhanced('/api/data', { method: 'GET' }); Copy
const enhanced = composeMiddleware([retry(), timeout()], globalThis.fetch);const response = await enhanced('/api/data', { method: 'GET' });
Composes an array of middlewares into a single wrapper around a FetchLike function.
Middlewares are applied in array order — the first middleware is the outermost wrapper (executes first on the way in, last on the way out).