Repository navigation
v3.0.0
[3.0.0] — 2026-04-22
Full architectural redesign. Pure functional TypeScript, 14 single-responsibility modules, zero runtime dependencies.
Breaking Changes
Content-Typeremoved fromDEFAULT_HEADERS— set per-request viagetBodyContentType()insteadpost/put/patchbody type is now the second generic parameter:post<TResponse, TBody>addRequestTransform/addResponseTransformdeprecated in favour of the interceptor APIutils.tsdissolved — its exports moved into six focused modules (url.ts,headers.ts,body.ts,response.ts,fetch.ts,errors.ts)
Added
- Interceptor system — axios-style request/response middleware with Map-based storage, auto-increment IDs, and
eject(id)/clear(). Request interceptors run LIFO; response interceptors run FIFO per retry attempt. RefetchErrordiscriminated union — per-kind fields (http,timeout,cancel,network,parse,unknown) alongsidePROBLEM_CODE- Retry —
RetryConfigper-request or instance-wide; shorthand number form; request interceptors run once before the retry loop stream()— returnsApiResponse<ReadableStream<T>>with no body parsing and no retrypipe()+ middleware HOFs —withAuth,withTimeout,withHeaders,withBaseURL,withLoggingcompose onto instances without mutation- Sub-path exports —
@mshindi-labs/refetch/retry,/middleware,/pipe(tree-shakeable) - Richer response body parsing —
+jsonsuffix MIME variants,application/x-www-form-urlencoded→Record<string,string>, binary MIME types →Blob, empty-body guard for 204/304/content-length: 0 CancelErrorandcreateCancelTokenfor explicit request cancellation
Changed
buildRefetchErrormoved toerrors.ts;RefetchErrortype defined intypes.ts- FormData
Content-Typeis always deleted so the browser can set the multipart boundary - README, CLAUDE.md, and CONTRIBUTING.md fully rewritten for v3