Registry / devops / ers-http

ers-http

JSON →
library10.0.9jsnpmunverified

A lightweight HTTP client library for Node.js and browser environments, providing a simple API for making HTTP requests. Current stable version is 10.0.9, released on an as-needed basis. Key differentiators include minimal configuration, built-in retry and timeout support, and TypeScript definitions. Compared to alternatives like axios or node-fetch, ers-http offers a smaller footprint and tighter integration with the ers ecosystem.

npm install ers-http
INSTALL
IMPORT
SIG · ERS-HTTP
E
ers-http
devopsjavascriptv10.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

http
import http from 'ers-http'
const http = require('ers-http')
Default import is the primary usage. ESM-only package; CommonJS require() will fail.
get, post, put, del
import { get, post, put, del } from 'ers-http'
import { get, post, put, delete } from 'ers-http'
Named exports for common HTTP methods. Use 'del' not 'delete' as 'delete' is a reserved keyword.
HttpError
import { HttpError } from 'ers-http'
Type/class for handling HTTP errors. Available since v10.

Shows default import, GET request with auth header, timeout/retry options, and proper error handling with HttpError.

import http from 'ers-http'; async function main() { try { const { data, status, headers } = await http.get('https://api.example.com/data', { headers: { 'Authorization': `Bearer ${process.env.API_KEY ?? ''}` }, timeout: 5000, retry: 2 }); console.log('Response:', data); } catch (err) { if (err instanceof http.HttpError) { console.error('HTTP Error:', err.status, err.message); } else { console.error('Request failed:', err.message); } } } main();
Debug
Known issues
breakingIn v10.0.0, the response object changed from `res` to `{ data, status, headers }`. Code accessing `res.data` or `res.status` must be updated.
fix
Use destructuring: const { data, status, headers } = await http.get(...)
affects: >=10.0.0
breakingPackage is ESM-only starting from v10.0.0. `require()` will throw an error.
fix
Convert to ESM: use `import` statements or set `"type": "module"` in package.json.
affects: >=10.0.0
deprecatedThe `http.request` method (lowercase) is deprecated. Use `http.get`, `http.post`, etc.
fix
Replace `http.request('GET', url)` with `http.get(url)`.
affects: >=9.0.0
gotchaThe `del` method is exported instead of `delete` due to JavaScript reserved word. Attempting to import `delete` will result in undefined.
fix
Use `import { del } from 'ers-http'` and call `del(url)`.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() on an ESM-only package.
fix
Switch to ESM: use import statements or set 'type': 'module' in package.json.
TypeError: Cannot destructure property 'data' of 'undefined' or 'null'.
Using older v9 response pattern with new v10 request.
fix
Update to new response format: const { data, status, headers } = await http.get(...)
Uncaught (in promise) TypeError: http.delete is not a function
Attempting to use 'delete' method that is exported as 'del'.
fix
Use import { del } from 'ers-http' and call del(url).
Upgrade
Version history
10.0.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
20
Resources
ers-http — npm install ers-http · libregistry