mande is a lightweight (~800 bytes) wrapper around the Fetch API that provides smart defaults for HTTP requests, including automatic JSON serialization/deserialization, error throwing on non-2xx responses, and automatic Content-Type headers. Version 2.0.9 is the latest stable release, with a relatively stable API and TypeScript support built-in. It differentiates from axios and ky by its minimal size, zero dependencies, and focus on simplicity. The library offers a clean, promise-based interface with GET, POST, PUT, PATCH, DELETE methods, global defaults, per-instance options, and request-level overrides. It works in modern browsers and Node.js with a fetch polyfill.
npm install mandeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of mande: creating an instance, performing GET/POST/PUT/DELETE requests, and using TypeScript generics for typed responses.
Use try/catch or .catch() to handle errors. The error object is an instance of the exported 'FetchError' type.
Use mande('/api') instead of mande('/api/') for consistency.Use the 'defaults' export or pass options per request instead of mutating instance.options.
Explicitly delete the header or set it to undefined if you want to keep the key without value.
To change redirect behavior, pass redirect option in the request options: { redirect: 'manual' }.Correct import: import { mande } from 'mande'Catch the error and check the response status: .catch(err => console.error(err.status))
Pass { responseAs: 'text' } or { responseAs: 'blob' } in request options to get non-JSON responses.Provide a fetch polyfill like 'node-fetch' and pass it as the third argument to mande().
No dependency data recorded yet.