A TypeScript-first collection of utility addons for the Fetch API, including helpers to serialize a Request to a cURL command (toCurl), create Request or Headers objects from init parameters (getRequest, getHeaders), and remove empty headers (deleteEmptyHeaders). Version 1.3.0 is stable, requires Node >= 16, and ships TypeScript declarations. Unlike manual fetch wrappers, fetch-addons focuses on debugging and transforming fetch inputs/outputs without patching global fetch.
npm install fetch-addonsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates the four main exports: creating a Request from fetch arguments, manipulating headers, and converting to cURL command.
Manually strip or mask sensitive headers before calling toCurl, or use a wrapper.
Pass the Headers object directly and be aware of mutation.
If passing a single Request, omit the second argument or pass undefined.
Use Node 16+ or provide a global fetch polyfill (e.g., undici, node-fetch).
Run 'npm install fetch-addons' and ensure import uses the package name exactly: 'import { toCurl } from 'fetch-addons'.Change 'import deleteEmptyHeaders from 'fetch-addons'' to 'import { deleteEmptyHeaders } from 'fetch-addons'.Convert FormData to a string or use a different tool for multipart requests.
Provide a default empty Headers: 'getHeaders(init.headers ?? {})'.