Registry / devops / isomorphic-fetch-http

isomorphic-fetch-http

JSON →
library3.0.0jsnpmunverified

A lightweight HTTP client built on top of isomorphic-fetch, designed for browser and Node.js environments with a simple API for GET, POST, PUT, DELETE, and JSON requests. Version 3.0.0 is the latest stable release. It provides global configuration (prefix, headers, cookies, filter, callback) and is primarily used with React/Redux applications. Compared to alternatives like axios, it has minimal dependencies but also limited features and less active maintenance.

npm install isomorphic-fetch-http
INSTALL
IMPORT
SIG · ISOMORPHIC-FETCH-H
I
isomorphic-fetch-http
devopsjavascriptv3.0.0
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 'isomorphic-fetch-http'
const http = require('isomorphic-fetch-http')
ESM-only; named export. CommonJS require will not work.
default import (no default export)
import { http } from 'isomorphic-fetch-http'
import http from 'isomorphic-fetch-http'
There is no default export. Only named export 'http'.
get
http.get('/path', params, headers)
http.get({url: '/path', params: ...})
Arguments are (url, params, headers), not an options object.

Shows global setup with prefix, cookies, filter, callback, and usage of GET and JSON POST.

import { http } from 'isomorphic-fetch-http' http.setup({ prefix: 'https://api.example.com', cookies: true, headers: { 'X-Custom': 'value' }, filter: async (data) => { const { url, headers, option } = data headers['Authorization'] = 'Bearer ' + (process.env.TOKEN ?? '') return { url, headers, option } }, callback: (response) => { const { status, data, message } = response if (status) return data throw new Error(message) } }) // Make a GET request http.get('/users', { page: 1 }, { 'X-Debug': 'true' }) .then(data => console.log(data)) .catch(err => console.error(err)) // POST with JSON body http.json('/users', { name: 'Alice' }) .then(res => console.log(res))
Debug
Known issues
gotchaThe callback function must return the processed response data; failing to do so will cause the promise to resolve with undefined.
fix
Ensure callback returns a value (e.g., return data;).
affects: >=3.0.0
deprecatedThe json method is just an alias for post with Content-Type application/json. It may be removed in future versions.
fix
Use http.post with explicit headers if maintaining forward compatibility.
affects: >=3.0.0
gotchaHeaders passed directly to get/post/put/delete override globally set headers. Local headers have highest priority.
fix
Be aware of priority: local headers > headers from setup > defaults.
affects: >=3.0.0
gotchaThe delete method is actually named http.put in the documentation example (typo). The correct method is http.delete.
fix
Use http.delete for DELETE requests, not http.put.
affects: >=3.0.0
breakingPackage is ESM-only; requires native fetch polyfill in older Node (<18). No CommonJS support.
fix
Use import syntax and ensure isomorphic-fetch or Node 18+.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: http.get is not a function
Incorrect default import: import http from 'isomorphic-fetch-http'
fix
Use named import: import { http } from 'isomorphic-fetch-http'
ReferenceError: fetch is not defined
Runtime environment lacks fetch support (e.g., Node <18 without polyfill)
fix
Install isomorphic-fetch and import it before isomorphic-fetch-http, or upgrade Node to 18+
http.setup is not a function
Import resolved to module without named exports, possibly due to CommonJS require
fix
Switch to ES module import syntax: import { http } from 'isomorphic-fetch-http'
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
isomorphic-fetchrequiredUnderlying fetch implementation for cross-platform support
Agent activity
13 hits · last 30 days
node
12
Resources
isomorphic-fetch-http — npm install isomorphic-fetch-http · libregistry