Modern HTTP Client Library

Modern HTTP Client Library

github.com

2

About this website

A tiny and elegant HTTP client built on the Fetch API, designed to provide a superior developer experience over the native fetch function with zero external dependencies and a bundle size of approximately 3.4 kilobytes gzipped. The library adds method shortcuts for all HTTP verbs, automatically treats non-2xx status codes as errors after redirects, provides built-in retry logic with configurable limits, status code filtering, exponential backoff, and jitter to prevent thundering herd problems on rate-limited endpoints. A JSON shorthand option handles automatic content-type headers and body serialization, while the typed response methods support generic type parameters for TypeScript projects, defaulting to the safer unknown type instead of any. Additional features include per-request timeout configuration with total timeout across retries, upload and download progress tracking via streaming callbacks, base URL resolution for API-specific instances, and a powerful hooks system with beforeRequest, afterResponse, beforeRetry, and onError callbacks for authentication refresh, request logging, and custom error handling. The library supports response validation with Standard Schema compatible validators including Zod and Valibot, enabling type-safe API consumption with runtime checking. Instances can be created with custom defaults for headers, prefix paths, and retry strategies using the extend method, allowing teams to build domain-specific clients. The client targets modern browsers, Node.js, Bun, and Deno with identical APIs across all runtimes, and is compatible with service workers and edge runtimes including Cloudflare Workers and Vercel Edge Functions.

Tags & Categories

Statistics

2
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!