A TypeScript-first HTTP client that wraps fetch with safe error handling, typed responses, configurable retries, timeouts, and support for Retry-After headers. Current stable version is 1.5.1, with infrequent releases. Unlike axios or got, it never throws on non-2xx responses, exposing both success and error types. Ships with TypeScript definitions, targets modern browsers, and requires minimal polyfills for IE11 or Node.js. It's small (under 3KB minzip) and provides a fluent API similar to fetch but with convenience methods like `.json()` and `.flush()`.
npm install gretchenNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage with type safety: fetch a user, handle errors without try/catch, and parse JSON response.
Use import syntax, or set { "type": "module" } in package.json if using Node.js.Always check the error property; do not rely on try/catch for HTTP errors.
Prefer .text() or .blob() over .flush() for non-JSON responses.
Use AbortController directly if you need to cancel the request.
Override delay option if you need custom retry intervals.
Update code to destructure { data, error, response } instead of { body }.Change to: import { gretch } from 'gretchen'Add "type": "module" to package.json, or use .mjs extension.
Ensure gretchen is installed and that you are using 'import { gretch } from 'gretchen' with correct casing.Install and import 'node-fetch' or use a global polyfill like 'cross-fetch'.
No dependency data recorded yet.