zlFetch is an ESM-only wrapper around the native Fetch API providing convenience features like automatic JSON/text/blob parsing, promise-like error handling (400/500 errors go to catch), built-in request abort, automatic Content-Type and Authorization headers, query string helpers, shorthand methods (GET, POST, PUT, PATCH, DELETE), streaming support (SSE, chunked), and instance creation for reusable config. Current stable version 6.3.1 (2023). Released as needed. Differentiators: error handling without try/catch, built-in debug logging, and full response object access without manual .json()/.text(). ESM-only since v4; no CommonJS support.
npm install zl-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates POST request with automatic JSON body serialization, auth header, and error handling.
Use import syntax or switch to v3.x (CJS).
Access parsed body via response.data; use response.body for unparsed content.
Use zlFetch.create(baseUrl, options) to create an instance.
Always use try/catch or catch block. For non-error 4xx, consider custom response handler.
Override with headers object if custom Content-Type needed.
Switch to import statement: import zlFetch from 'zl-fetch'
Run 'npm install zl-fetch' and ensure import is 'zl-fetch' not 'zl-fetch/src'.
Ensure body is JSON-serializable object, plain string, or FormData/Blob.
Check server CORS headers; zlFetch's error handling only applies after successful fetch.
No dependency data recorded yet.