A tiny abstraction over the Fetch API for building featureful API clients. Current version 3.3.6. Released regularly on npm. Provides a CredentialsManager and visitor pattern for request/response handling, plus a TestHarness for mocking HTTP calls in tests using Node.js built-in test framework. Distinguishes itself by being lightweight (1.3KB bundle) and focused on the fetch API with no external runtime dependencies.
npm install http-with-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an API client with custom credentials manager and visitor for response handling, then make a GET request.
Use client.execute({ method: 'GET', url: '/path' }) instead of client.get('/path') when you need to mock requests with TestHarness.Use import syntax or dynamic import('http-with-fetch'). Ensure your project is configured for ESM (type: 'module' in package.json).Update TestHarness constructor calls: new TestHarness(client, t, handler) instead of old signature.
import { TestHarness } from 'http-with-fetch/harness'Pass visitor to createApiClient: createApiClient({ credentials, visitor })No dependency data recorded yet.