A lightweight, dependency-injected HTTP client for Node.js and browser with built-in plugins for serialization, mocking, and interceptors. Current stable version is 0.1.4, released on npm. It ships TypeScript types and follows a fetch-like API with extensible engine. Key differentiator: plugin-based architecture via interceptor hooks (willFetch, didFetch) and support for custom HTTP clients like Taro. No external dependencies.
npm install di-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a FetchEngine with base URL, adds serialization plugin, and performs a GET request.
Always call engine.use(serializeDataPlugin()) when sending JSON data.
Ensure each mock object has endpoint (string) and method (string).
Verify custom client has a request method returning a promise with similar signature.
Run npm install di-fetch or yarn add di-fetch.
Create an instance: const engine = new FetchEngine({...}); then engine.use().Ensure engine is an instance of FetchEngine: const engine = new FetchEngine(options);
No dependency data recorded yet.