Registry / devops / stubborn-fetch

stubborn-fetch

JSON →
library0.2.8jsnpmunverified

A lightweight fetch wrapper that adds configurable retry logic to HTTP requests. Version 0.2.8 is the latest stable release, with no regular release cadence. It supports exponential backoff, customizable retry conditions based on status codes or network failures, and global error limits. Unlike more opinionated libraries like axios-retry, stubborn-fetch offers fine-grained control over retry timing and per-request options while remaining minimal in size.

npm install stubborn-fetch
INSTALL
IMPORT
SIG · STUBBORN-FETCH
S
stubborn-fetch
devopsjavascriptv0.2.8
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.

StubbornFetch
import StubbornFetch from 'stubborn-fetch'
const StubbornFetch = require('stubborn-fetch')
Package exports a default class; CommonJS require works but is non-standard
StubbornFetchRequest
import { StubbornFetchRequest } from 'stubborn-fetch'
Named export for the request class; also exported as default
StubbornFetchError
import { StubbornFetchError } from 'stubborn-fetch'
Error class used for retry callbacks

Configures a GET request with 3 retries on server errors or network failures using exponential backoff.

import StubbornFetch, { StubbornFetchRequest } from 'stubborn-fetch'; const request = new StubbornFetchRequest('https://api.example.com/data', { method: 'GET' }, { retries: 3, timingFunction: 'exponential', maxDelay: 30000, minimumStatusCodeForRetry: 500, retryOnNetworkFailure: true }); request.send().then(response => { console.log('Success:', response); }).catch(error => { console.error('Failed:', error); });
Debug
Known issues
gotchaMinimum status code for retry includes both server errors and client errors by default (400). This may cause unintended retries on 4xx responses.
fix
Set minimumStatusCodeForRetry to 500 or implement shouldRetry to exclude certain status codes.
affects: >=0.1.0
gotchaRetry on network failure is disabled by default. Network errors will reject the promise without retry.
fix
Set retryOnNetworkFailure: true in options.
affects: >=0.1.0
gotchaTiming function is a string that maps to predefined functions; custom functions are not supported via string.
fix
Only 'exponential' and 'linear' are supported; custom timing requires implementing your own retry logic.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: StubbornFetchRequest is not a constructor
Using default import but StubbornFetchRequest is a named export.
fix
Use import { StubbornFetchRequest } from 'stubborn-fetch' instead of import StubbornFetchRequest from ...
Error: timingFunction must be one of: exponential, linear
Passing an unsupported timing function string.
fix
Use 'exponential' or 'linear' for timingFunction.
Upgrade
Version history
0.2.8latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
stubborn-fetch — npm install stubborn-fetch · libregistry