Extend the WHATWG fetch API with middleware in a transparent, recursive manner. Current stable version is 0.1.2. It allows chaining of middleware functions that can modify URLs, options, response handling, and error catching. Key differentiators include built-in middleware for URL parameters, conditional options by URL pattern, JSON serialization/deserialization, and logging. Supports any fetch implementation (native, ponyfill, polyfill) and is isomorphic. Unit tested and benchmarked against plain fetch.
npm install fetch-wrapNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an enhanced fetch with URL parameter substitution, automatic JSON parsing, and logging.
Refer to source code or consider pinning version; watch for breaking changes.
Add a .catch handler or use try/catch with async/await.
Sanitize parameters before passing to urlParams.
Plan middleware order carefully: URL/header mods first, then JSON handling, then logging.
Use const fetchWrap = require('fetch-wrap').default; or switch to ESM import.Use correct import: import { urlParams, receiveJson } from 'fetch-wrap/middleware';Ensure each middleware is a function with signature (url, options, innerFetch) => ...
No dependency data recorded yet.