ffetch 5.1.0 adds opt-in request and response shortcuts
Shipped ffetch 5.1.0.
ffetch is a lightweight, production-ready HTTP client that wraps native fetch with built-in timeouts, retries with exponential backoff, lifecycle hooks, and pending request tracking. Works across browsers, Node, SSR, and edge runtimes.
New in v5.1.0: two opt-in convenience plugins.
Usage:
import { createClient } from '@fetchkit/ffetch' import { requestShortcutsPlugin } from '@fetchkit/ffetch/plugins/request-shortcuts' import { responseShortcutsPlugin } from '@fetchkit/ffetch/plugins/response-shortcuts' const api = createClient({ timeout: 10000, retries: 3, retryDelay: (ctx) => Math.pow(2, ctx.attempt - 1) * 1000 + Math.random() * 1000, plugins: [requestShortcutsPlugin(), responseShortcutsPlugin()], }) const todo = await api.get('/todos/1').json()
Exponential backoff with jitter: each retry waits 2\^(attempt-1) seconds plus random jitter, with timeout of 10s and max 3 retries. Plugins are optional, default behavior stays fetch-compatible. #technology #dev #js #programming