axios, got, isomorphic-fetch, and node-fetch are all tools for making HTTP requests, but they target different environments and development needs. axios is a promise-based HTTP client that works in both the browser and Node.js, known for its automatic JSON transformation and interceptors. got is a human-friendly HTTP client specifically for Node.js, offering advanced features like pagination and robust retry logic. isomorphic-fetch is a polyfill that enables the native fetch API in older environments, while node-fetch brings the fetch API specifically to Node.js environments prior to native support. Choosing between them depends on whether you need isomorphic code, Node-specific power features, or alignment with web standards.
When architecting data layers for modern web applications, the choice of HTTP client impacts everything from bundle size to error handling strategies. axios, got, isomorphic-fetch, and node-fetch all solve the same fundamental problem β making HTTP requests β but they approach it from different angles. Let's compare how they handle real-world engineering scenarios.
axios is truly isomorphic.
XMLHttpRequest in the browser and the native http module in Node.js.// axios: Works in Browser and Node
import axios from 'axios';
const res = await axios.get('/api/data');
got is strictly for Node.js.
http and tls.// got: Node.js Only
import got from 'got';
const res = await got.get('https://api.example.com/data');
isomorphic-fetch polyfills the global environment.
fetch into the global scope for both Node and older browsers.fetch.// isomorphic-fetch: Global Polyfill
import 'isomorphic-fetch';
const res = await fetch('/api/data'); // Uses injected global
node-fetch is for Node.js environments.
fetch standard specifically for server-side JavaScript.fetch makes this package less critical.// node-fetch: Node.js Implementation
import fetch from 'node-fetch';
const res = await fetch('https://api.example.com/data');
axios wraps the response in an object and parses JSON automatically.
response.data..json() manually, which reduces boilerplate.// axios: Auto-parsed JSON
const response = await axios.get('/api/user');
console.log(response.data); // Direct access to parsed body
got also simplifies response handling but returns a plain object.
Content-Type header matches.response.body.// got: Auto-parsed JSON
const response = await got.get('https://api.example.com/user');
console.log(response.body); // Direct access to parsed body
isomorphic-fetch follows the strict Fetch API standard.
.json() to read the payload.// isomorphic-fetch: Manual JSON parsing
const response = await fetch('/api/user');
const data = await response.json(); // Explicit parsing required
node-fetch mirrors the standard Fetch API behavior.
isomorphic-fetch, it requires manual parsing.fetch but adds extra lines of code.// node-fetch: Manual JSON parsing
const response = await fetch('https://api.example.com/user');
const data = await response.json(); // Explicit parsing required
axios throws an error for any HTTP status outside 2xx.
catch block.// axios: Throws on 4xx/5xx
try {
await axios.get('/api/protected');
} catch (error) {
if (error.response) console.log(error.response.status);
}
got provides detailed error classes for different failure types.
RequestError, HTTPError, and TimeoutError.// got: Detailed Error Classes
try {
await got.get('https://api.example.com/protected');
} catch (error) {
if (error instanceof got.HTTPError) console.log(error.response.statusCode);
}
isomorphic-fetch does not throw on HTTP errors (4xx/5xx).
response.ok to handle HTTP errors.// isomorphic-fetch: Manual Error Check
const response = await fetch('/api/protected');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
node-fetch behaves identically to the standard Fetch API.
// node-fetch: Manual Error Check
const response = await fetch('https://api.example.com/protected');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
axios uses interceptors to modify requests or responses globally.
// axios: Request Interceptors
axios.interceptors.request.use(config => {
config.headers.Authorization = 'Bearer token';
return config;
});
got uses hooks to achieve similar goals with more control.
// got: Hooks
const api = got.extend({
hooks: {
beforeRequest: [
options => { options.headers.authorization = 'Bearer token'; }
]
}
});
isomorphic-fetch has no built-in interception mechanism.
fetch in a custom function.// isomorphic-fetch: Custom Wrapper
const originalFetch = fetch;
const fetchWithAuth = (url, opts = {}) => {
opts.headers = { ...opts.headers, Authorization: 'Bearer token' };
return originalFetch(url, opts);
};
node-fetch also lacks native interceptors.
isomorphic-fetch, you need to create a wrapper function for global logic.// node-fetch: Custom Wrapper
const originalFetch = fetch;
const fetchWithAuth = (url, opts = {}) => {
opts.headers = { ...opts.headers, Authorization: 'Bearer token' };
return originalFetch(url, opts);
};
axios remains actively maintained with a large community.
got is actively developed for the Node ecosystem.
isomorphic-fetch is considered legacy in modern stacks.
fetch is now available in all major browsers and Node 18+.node-fetch is stable but less critical with Node 18+.
fetch in new Node projects where possible.| Feature | axios | got | isomorphic-fetch | node-fetch |
|---|---|---|---|---|
| Environment | π Browser & Node | π₯οΈ Node Only | π Browser & Node (Polyfill) | π₯οΈ Node Only |
| JSON Parsing | β Automatic | β Automatic | β Manual (.json()) | β Manual (.json()) |
| Error Handling | β οΈ Throws on 4xx/5xx | β οΈ Throws on 4xx/5xx | β OK Status Check | β OK Status Check |
| Interceptors | π οΈ Built-in | π οΈ Hooks | β Custom Wrapper | β Custom Wrapper |
| Status | π’ Active | π’ Active | π‘ Legacy | π’ Stable |
axios is the pragmatic choice for full-stack teams π§°. It reduces boilerplate with auto-parsing and interceptors, making it ideal for dashboards, admin panels, and apps where client/server code sharing matters.
got is the power user's tool for Node.js π§. If you are building backend services, CLI tools, or scripts, its advanced retry logic and error details save hours of debugging.
isomorphic-fetch and node-fetch are for standard-compliance purists π. They are useful if you want to match browser fetch behavior exactly, but be aware that isomorphic-fetch is fading in favor of native implementations.
Final Thought: For most modern frontend architectures, native fetch (with a small wrapper for error handling) or axios (for interceptors) are the top contenders. Reserve got for dedicated Node.js services where its specific strengths shine.
Choose got if you are building a backend or CLI tool strictly in Node.js. It offers superior developer experience for server-side tasks, including built-in pagination, advanced retry strategies, and detailed error reporting that axios or fetch do not provide out of the box.
Choose axios if you need a single library that works identically in both the browser and Node.js without configuration. It is ideal for projects that rely heavily on interceptors for authentication or logging, and for teams that prefer automatic JSON parsing over manual response handling.
Choose isomorphic-fetch only if you must support legacy environments that lack native fetch and you want to write standard fetch syntax. However, for new projects, prefer native fetch or axios, as this package is considered legacy and adds unnecessary global polyfills.
Choose node-fetch if you are on Node.js versions prior to 18 and want to use the standard fetch API syntax without the extra features of axios. Note that version 3 is ESM-only, so ensure your project supports ES modules, or stick to version 2 for CommonJS.
Sindre's open source work is supported by the community.
Special thanks to:
Human-friendly and powerful HTTP request library for Node.js
See how Got compares to other HTTP libraries
You probably want Ky instead, by the same people. It's smaller, works in the browser too, and is more stable since it's built on Fetch. Or fetch-extras for simple needs.
Support questions should be asked here.
npm install got
Warning: This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM. Please don't open issues for questions regarding CommonJS / ESM.
Got v11 is no longer maintained and we will not accept any backport requests.
A quick start guide is available.
Got has a dedicated option for handling JSON payload.
Furthermore, the promise exposes a .json<T>() function that returns Promise<T>.
import got from 'got';
const {data} = await got.post('https://httpbin.org/anything', {
json: {
hello: 'world'
}
}).json();
console.log(data);
//=> {"hello": "world"}
For advanced JSON usage, check out the parseJson and stringifyJson options.
For more useful tips like this, visit the Tips page.
By default, Got will retry on failure. To disable this option, set options.retry.limit to 0.
got4aws - Got convenience wrapper to interact with AWS v4 signed APIsgh-got - Got convenience wrapper to interact with the GitHub APIgl-got - Got convenience wrapper to interact with the GitLab APIgotql - Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of stringsgot-fetch - Got with a fetch interfacegot-scraping - Got wrapper specifically designed for web scraping purposesgot-ssrf - Got wrapper to protect server-side requests against SSRF attacksgot | node-fetch | ky | axios | superagent | |
|---|---|---|---|---|---|
| HTTP/2 support | :heavy_check_mark:ΒΉ | :x: | :heavy_check_mark: | :x: | :heavy_check_mark:** |
| Browser support | :x: | :heavy_check_mark:* | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Promise API | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Stream API | :heavy_check_mark: | Node.js only | :x: | :x: | :heavy_check_mark: |
| Pagination API | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Request cancelation | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| RFC compliant caching | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Cookies (out-of-the-box) | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Follows redirects | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Retries on failure | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: |
| Progress events | :heavy_check_mark: | :x: | :heavy_check_mark: | Browser only | :heavy_check_mark: |
| Handles gzip/deflate | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Advanced timeouts | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Timings | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Errors with metadata | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| JSON mode | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Custom defaults | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| Composable | :heavy_check_mark: | :x: | :x: | :x: | :heavy_check_mark: |
| Hooks | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| Issues open | |||||
| Issues closed | |||||
| Downloads | |||||
| Coverage | TBD | ||||
| Build | |||||
| Bugs | |||||
| Dependents | |||||
| Install size | |||||
| GitHub stars | |||||
| TypeScript support | |||||
| Last commit |
* It's almost API compatible with the browser fetch API.
** Need to switch the protocol manually. Doesn't accept PUSH streams and doesn't reuse HTTP/2 sessions.
ΒΉ Requires Node.js 15.10.0 or above.
:sparkle: Almost-stable feature, but the API may change. Don't hesitate to try it out!
:grey_question: Feature in early stage of development. Very experimental.
Click here to see the install size of the Got dependencies.
![]() | ![]() |
|---|---|
| Sindre Sorhus | Szymon Marczak |
|
|
|
|
|
|
|
|
|
|
Segment is a happy user of Got! Got powers the main backend API that our app talks to. It's used by our in-house RPC client that we use to communicate with all microservices.
β Vadim Demedes
Antora, a static site generator for creating documentation sites, uses Got to download the UI bundle. In Antora, the UI bundle (aka theme) is maintained as a separate project. That project exports the UI as a zip file we call the UI bundle. The main site generator downloads that UI from a URL using Got and streams it to vinyl-zip to extract the files. Those files go on to be used to create the HTML pages and supporting assets.
β Dan Allen
GetVoIP is happily using Got in production. One of the unique capabilities of Got is the ability to handle Unix sockets which enables us to build a full control interfaces for our docker stack.
β Daniel Kalen
We're using Got inside of Exoframe to handle all the communication between CLI and server. Exoframe is a self-hosted tool that allows simple one-command deployments using Docker.
β Tim Ermilov
Karaoke Mugen uses Got to fetch content updates from its online server.
β Axel Terizaki
Renovate uses Got, gh-got and gl-got to send millions of queries per day to GitHub, GitLab, npmjs, PyPi, Packagist, Docker Hub, Terraform, CircleCI, and more.
β Rhys Arkins
Resistbot uses Got to communicate from the API frontend where all correspondence ingresses to the officials lookup database in back.
β Chris Erickson
Natural Cycles is using Got to communicate with all kinds of 3rd-party REST APIs (over 9000!).
β Kirill Groshkov
Microlink is a cloud browser as an API service that uses Got widely as the main HTTP client, serving ~22M requests a month, every time a network call needs to be performed.
β Kiko Beats
Weβre using Got at Radity. Thanks for such an amazing work!
β Mirzayev Farid