A lightweight HTTP client library for making REST API requests, built on top of the Fetch API. Current stable version is 2.22.18. It provides a simple Api class with methods for GET, POST, PUT, DELETE, and custom requests. Ships TypeScript definitions. Supports custom response processors, default headers, multiple data formats (JSON, FormData), and query parameter encoding. Unlike axios or node-fetch, it leverages the Fetch API standard and requires a polyfill for Node.js. Ideal for browser and Node.js environments with minimal configuration. Release cadence is irregular but maintained.
npm install rest-api-handlerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an Api instance with custom response processors and make a GET request with typed response.
Install and import a fetch polyfill such as 'cross-fetch' before using this library in Node: require('cross-fetch/polyfill');Use a fetch polyfill for older browsers.
Update code to access response.code and response.data instead of response.status and response.json().
Install cross-fetch: npm install cross-fetch --save, then add require('cross-fetch/polyfill'); at entry point.Run npm install rest-api-handler --save and use correct import: import { Api } from 'rest-api-handler';Use import { DefaultResponseProcessor } from 'rest-api-handler'; and ensure correct spelling.No dependency data recorded yet.