Collection of all qfetch middlewares - convenience package for importing all middlewares at once.
This package re-exports all official qfetch middlewares with pinned versions, providing a single import point for all middleware functionality.
Included middlewares:
@qfetch/middleware-authorization - Authorization header injection with 401 retry@qfetch/middleware-base-url - Base URL resolution@qfetch/middleware-query-params - Query parameter management@qfetch/middleware-retry-after - Retry-After header handling@qfetch/middleware-retry-status - Status code based retrynpm install @qfetch/middlewares @qfetch/core
import {
withAuthorization,
withBaseUrl,
withQueryParams,
withRetryAfter,
withRetryStatus,
} from "@qfetch/middlewares";
import { compose } from "@qfetch/core";
const qfetch = compose(
withRetryStatus({ statuses: [500, 502, 503], strategy: () => /* ... */ }),
withRetryAfter(),
withQueryParams({ version: "v2" }),
withBaseUrl("https://api.example.com")
)(fetch);
await qfetch("/users");
For more control over versions or to reduce bundle size, you can install middlewares individually:
npm install @qfetch/middleware-base-url @qfetch/middleware-retry-status
All exports from individual middleware packages are re-exported:
withAuthorization(opts) - Adds authorization headers with 401 retryAuthorizationOptions, AuthorizationToken, TokenProvider typeswithBaseUrl(baseUrl) - Resolves relative URLs against a base URLwithQueryParam(name, value, opts?) - Adds a single query parameterwithQueryParams(params, opts?) - Adds multiple query parametersArrayFormat, QueryParamOptions, QueryParamsOptions, QueryValue typeswithRetryAfter(opts?) - Handles Retry-After response headersRetryAfterOptions typewithRetryStatus(opts) - Retries on specific HTTP status codesRetryStatusOptions typeThis package pins exact versions of all middleware dependencies to ensure consistent behavior. When new middleware versions are released, this package will be updated with a corresponding version bump.