got vs requestretry vs node-fetch-retry vs axios-retry vs retry-axios vs superagent-retry
HTTP Request Retry Libraries for JavaScript Applications
gotrequestretrynode-fetch-retryaxios-retryretry-axiossuperagent-retrySimilar Packages:

HTTP Request Retry Libraries for JavaScript Applications

axios-retry, got, node-fetch-retry, requestretry, retry-axios, and superagent-retry are npm packages that add automatic retry capabilities to HTTP requests in JavaScript applications. They help developers handle transient network failures—such as timeouts, 5xx server errors, or rate-limiting—by reissuing failed requests according to configurable policies. These libraries differ in their integration approach (plugin vs. built-in), supported HTTP clients, configuration flexibility, and maintenance status.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
got42,182,36614,949488 kB017 hours agoMIT
requestretry166,68634656.5 kB13a year agoMIT
node-fetch-retry29,51097.94 kB3-MIT
axios-retry02,01033.6 kB582 years agoApache-2.0
retry-axios051264.9 kB16 months agoApache-2.0
superagent-retry083-1010 years ago-

HTTP Request Retry Strategies in JavaScript: A Deep Dive

When building resilient web applications, handling transient network failures is non-negotiable. The packages axios-retry, got, node-fetch-retry, requestretry, retry-axios, and superagent-retry all aim to automate retry logic for failed HTTP requests — but they differ significantly in architecture, flexibility, and ecosystem alignment. Let’s examine how each approaches retries and when to use which.

🧩 Core Architecture: Standalone vs Plugin vs Built-In

axios-retry is a plugin that extends the popular axios HTTP client using its interceptor system. It doesn’t replace axios; it enhances it.

import axios from 'axios';
import axiosRetry from 'axios-retry';

axiosRetry(axios, { retries: 3 });

// Now all axios requests will retry automatically
await axios.get('/api/data');

retry-axios (often abbreviated rax) also integrates with axios, but uses a different mechanism: it wraps the request in a retry-aware function that can be applied per-call or globally.

import * as rax from 'retry-axios';
import axios from 'axios';

const interceptorId = rax.attach(); // attaches globally

// Or use per-request:
await rax(axios.get('/api/data'), { retry: 3 });

superagent-retry works similarly as a plugin for the superagent HTTP library. You call .retry() on a request chain.

import superagent from 'superagent';
import 'superagent-retry';

await superagent
  .get('/api/data')
  .retry(3) // retries up to 3 times
  .end();

node-fetch-retry wraps the native-like node-fetch API and adds retry options directly to the fetch call.

import fetchRetry from 'node-fetch-retry';

await fetchRetry('/api/data', {
  retries: 3,
  retryDelay: 1000
});

requestretry is a full replacement for the now-deprecated request library, bundling retry logic into its core API.

import request from 'requestretry';

request({
  url: '/api/data',
  maxAttempts: 3,
  retryDelay: 1000
}, (err, response, body) => {
  // handle result
});

got stands apart: retry logic is built directly into its core design. No plugins needed — retries are a first-class feature.

import got from 'got';

await got('/api/data', {
  retry: {
    limit: 3,
    methods: ['GET', 'PUT']
  }
});

⚠️ Important: The request library (and by extension requestretry) has been officially deprecated since February 2020. While requestretry still functions, it should not be used in new projects due to lack of modern maintenance and reliance on an outdated HTTP client.

🎯 Retry Configuration Granularity

How much control do you get over when and how retries happen?

got offers the most granular control. You can specify:

  • Which HTTP methods to retry
  • Which status codes trigger retries
  • Custom retry conditions via functions
  • Exponential backoff with jitter
await got('/api/data', {
  retry: {
    limit: 3,
    methods: ['GET', 'HEAD'],
    statusCodes: [408, 413, 429, 500, 502, 503, 504],
    calculateDelay: ({ attemptCount }) => Math.pow(2, attemptCount) * 1000
  }
});

axios-retry allows custom retry conditions via the retryCondition option and supports exponential backoff through retryDelay.

axiosRetry(axios, {
  retries: 3,
  retryCondition: (error) => {
    return error.response?.status === 503;
  },
  retryDelay: axiosRetry.exponentialDelay
});

retry-axios provides similar configurability, including custom retry logic and delay strategies.

await rax(axios.get('/api/data'), {
  retry: 3,
  noResponseRetries: 2,
  httpMethodsToRetry: ['GET', 'HEAD'],
  statusCodesToRetry: [[100, 199], [429, 429], [500, 599]]
});

superagent-retry is more limited — it retries on network errors and specific status codes (5xx by default), but customization requires overriding internal methods.

superagent
  .get('/api/data')
  .retry(3, [500, 502, 503]) // only these statuses
  .end();

node-fetch-retry supports basic options like retries, retryDelay, and retryOn, but lacks deep customization.

fetchRetry('/api/data', {
  retries: 3,
  retryOn: (attempt, error, response) => response?.status === 503
});

requestretry allows setting maxAttempts, retryDelay, and retryStrategy, but again, this is built on a deprecated foundation.

🔄 Backoff Strategies

All packages support some form of delay between retries, but implementation varies.

  • got: Full control via calculateDelay function; includes built-in backoff option.
  • axios-retry: Provides exponentialDelay, linearDelay, or custom functions.
  • retry-axios: Uses exponential backoff by default; configurable via currentRetryAttempt.
  • superagent-retry: Simple linear delay; no built-in exponential strategy.
  • node-fetch-retry: Accepts static retryDelay or a function (retryNumber) => delay.
  • requestretry: Supports retryDelay and retryDelayMultiplier for exponential behavior.

🌐 Ecosystem Alignment

Your choice often depends on your existing HTTP client:

  • Already using axios? → Choose axios-retry (more widely adopted) or retry-axios (more Google-centric).
  • Using superagent? → superagent-retry is your only real option.
  • Prefer native fetch? → node-fetch-retry gives you retry logic while keeping a familiar API.
  • Starting fresh or want maximum control? → got is purpose-built for robust HTTP interactions with retries as a core concern.
  • Still on request? → Migrate away; do not start new projects with requestretry.

💡 Real-World Recommendation

  • For new projects: Use got if you’re in Node.js and need maximum reliability and configurability. It’s actively maintained, modern, and retry logic is deeply integrated.
  • In an axios-based frontend/backend: axios-retry is the community standard — simple to set up and well-documented.
  • If you must use fetch: node-fetch-retry is acceptable for basic needs, but consider wrapping fetch yourself with a lightweight retry utility if requirements grow.
  • Avoid: requestretry due to its dependency on the deprecated request library. Also avoid mixing multiple retry strategies across your codebase — pick one HTTP client and stick with its retry solution.

📊 Summary Table

PackageTypeHTTP ClientCustom ConditionsBackoff ControlActive Maintenance
axios-retryPluginaxios✅✅ (predefined + custom)✅
retry-axiosWrapperaxios✅✅✅
superagent-retryPluginsuperagent⚠️ (limited)❌ (basic only)✅
node-fetch-retryWrappernode-fetch✅ (basic)✅ (simple)✅
requestretryFull clientrequest (deprecated)✅✅❌ (avoid)
gotBuilt-ingot✅ (full)✅ (advanced)✅

🔚 Final Thought

Retry logic seems simple until you’re debugging why a critical API call failed silently in production. The right tool gives you visibility, control, and confidence. If you’re already invested in an HTTP client like axios, extend it with its ecosystem’s retry package. But if you’re choosing from scratch — especially for backend services where reliability is paramount — got’s thoughtful, integrated approach makes it the strongest choice today.

How to Choose: got vs requestretry vs node-fetch-retry vs axios-retry vs retry-axios vs superagent-retry

  • got:

    Choose got if you're starting a new Node.js project and need a modern, full-featured HTTP client with retry logic built directly into its core. It offers the most granular control over retry conditions, status codes, methods, and backoff strategies, and is actively maintained with a focus on reliability and developer experience.

  • requestretry:

    Do not choose requestretry for new projects. It extends the request library, which has been officially deprecated since 2020. While it may still work, it lacks modern maintenance, security updates, and compatibility with current Node.js best practices. Migrate existing usage to alternatives like got or axios with retry plugins.

  • node-fetch-retry:

    Choose node-fetch-retry if you prefer using a fetch-like API in Node.js and need basic retry functionality without switching HTTP clients. It’s a lightweight wrapper around node-fetch that adds retry options, but lacks the advanced customization found in more specialized libraries like got.

  • axios-retry:

    Choose axios-retry if you're already using axios and want a widely adopted, easy-to-integrate retry plugin that leverages axios interceptors. It supports custom retry conditions and built-in delay strategies like exponential backoff, making it suitable for both frontend and Node.js environments where axios is the standard HTTP client.

  • retry-axios:

    Choose retry-axios (also known as rax) if you're in a Google Cloud or TypeScript-heavy environment and need fine-grained control over axios retries, including per-request configuration and detailed status code ranges. It’s a solid alternative to axios-retry, though slightly less common in the broader ecosystem.

  • superagent-retry:

    Choose superagent-retry only if your project already relies on the superagent HTTP library and you need simple retry logic. It integrates cleanly via method chaining but offers limited customization for retry conditions and backoff strategies compared to more flexible alternatives.

README for got



Got




Sindre's open source work is supported by the community.
Special thanks to:



Fame Helsinki Fame Helsinki



Depot logo
Fast remote container builds and GitHub Actions runners.











Human-friendly and powerful HTTP request library for Node.js

Downloads Install size

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.

Install

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.

Take a peek

A quick start guide is available.

JSON mode

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.

Highlights

Documentation

By default, Got will retry on failure. To disable this option, set options.retry.limit to 0.

Main API

Timeouts and retries

Advanced creation

Cache, Proxy and UNIX sockets

Integration


Migration guides

Got plugins

  • got4aws - Got convenience wrapper to interact with AWS v4 signed APIs
  • gh-got - Got convenience wrapper to interact with the GitHub API
  • gl-got - Got convenience wrapper to interact with the GitLab API
  • gotql - Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of strings
  • got-fetch - Got with a fetch interface
  • got-scraping - Got wrapper specifically designed for web scraping purposes
  • got-ssrf - Got wrapper to protect server-side requests against SSRF attacks

Comparison

gotnode-fetchkyaxiossuperagent
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 aborting:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
RFC 7234 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
CoverageTBD
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.
: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.

Maintainers

Sindre SorhusSzymon Marczak
Sindre SorhusSzymon Marczak