All languages

JavaScript

You're viewing a free preview. Sign in free to read every script.

Why this exists Since Node 18, fetch is built in. Its two big surprises catch everyone: it has no timeout by default, and it does not throw for HTTP error statuses. A reliable integration handles both, and adds careful…

HTTP Requests with fetch: Timeouts, Status Checks, JSON and Retries with Backoff

Use the built-in fetch reliably: AbortSignal.timeout, checking response.ok (fetch does not reject on 4xx or 5xx), sending JSON, authentication from the environment, and a retry helper with exponential backoff and jitter that only retries what can succeed.

Sign in free to read this script, along with the rest of the library.

Sign in free