u/sindresorhus

fetch-extras — Build your own HTTP client with Fetch

Tired of reaching for a big HTTP client when you just need a timeout or retry? fetch-extras gives you small, single-purpose with* functions that wrap the standard fetch. Stack only what you need: timeouts, base URLs, retries, rate limiting, caching, auth token refresh, progress tracking, and more.


It has everything you will need:

  • Retries
  • Timeouts
  • HTTP error throwing (non-2xx)
  • Base URL (resolve relative URLs against a base)
  • Default headers
  • Client-side rate limiting
  • Concurrency limiting
  • Request deduplication
  • In-memory caching
  • Before/after request hooks
  • Auto JSON body stringify
  • Default search parameters
  • Download/upload progress tracking
  • Pagination
  • Auto token refresh on 401
github.com
u/sindresorhus — 15 hours ago