lunex-http
Version:
A lightweight and flexible REST API client for JavaScript and TypeScript, supporting CommonJS and ES modules (ESM). Features include HTTP methods (GET, POST, PUT, PATCH, DELETE), built-in retry policies with exponential backoff, request lifecycle hooks fo
14 lines (13 loc) • 356 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shouldRetry = shouldRetry;
/**
* Default retry condition for transient errors.
* @param response - Fetch API response object
* @returns Whether the request should be retried
*/
function shouldRetry(response) {
return [502, 503, 504].includes(response.status);
}