UNPKG

@bishal-shrestha/rest-client

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

8 lines 248 B
/** * Default retry condition for transient errors. * @param response - Fetch API response object * @returns Whether the request should be retried */ export function shouldRetry(response) { return [502, 503, 504].includes(response.status); }