{"id":18821146,"url":"https://github.com/compwright/axios-retry-after","last_synced_at":"2025-04-14T00:26:08.645Z","repository":{"id":38308975,"uuid":"281204074","full_name":"compwright/axios-retry-after","owner":"compwright","description":"A tiny HTTP 429 Retry-After interceptor for axios","archived":false,"fork":false,"pushed_at":"2024-06-19T13:17:53.000Z","size":456,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T02:38:02.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compwright.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"compwright"}},"created_at":"2020-07-20T19:09:25.000Z","updated_at":"2024-04-28T19:50:37.000Z","dependencies_parsed_at":"2024-10-30T01:53:30.143Z","dependency_job_id":null,"html_url":"https://github.com/compwright/axios-retry-after","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.5862068965517242,"last_synced_commit":"41b975f3da3ff5f1d7bd5762ab99a663f1379b70"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-retry-after","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-retry-after/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-retry-after/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compwright%2Faxios-retry-after/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compwright","download_url":"https://codeload.github.com/compwright/axios-retry-after/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248800112,"owners_count":21163404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:34:35.068Z","updated_at":"2025-04-14T00:26:08.615Z","avatar_url":"https://github.com/compwright.png","language":"JavaScript","funding_links":["https://github.com/sponsors/compwright"],"categories":[],"sub_categories":[],"readme":"# axios-retry-after\n\n[![Build Status](https://travis-ci.org/compwright/axios-retry-after.png?branch=master)](https://travis-ci.org/compwright/axios-retry-after)\n[![Download Status](https://img.shields.io/npm/dm/axios-retry-after.svg?style=flat-square)](https://www.npmjs.com/package/axios-retry-after)\n[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor\u0026message=❤\u0026logo=GitHub\u0026link=https://github.com/sponsors/compwright)](https://github.com/sponsors/compwright)\n\nA tiny HTTP retry interceptor for [axios](https://www.npmjs.com/package/axios).\n\nThis interceptor catches HTTP 429 errors, reads the `Retry-After` header, and retries the request at the proper type.\n\n## Installation\n\nWith NPM:\n\n```bash\nnpm install --save axios-retry-after\n```\n\nWith Yarn:\n\n```bash\nyarn add axios-retry-after\n```\n\n## Example usage\n\n```javascript\nimport axios from 'axios'\nimport retry from 'axios-retry-after'\nconst client = axios.createClient()\nclient.interceptors.response.use(null, retry(client))\n```\n\n## Customizing retry behavior\n\nYou can optionally customize the behavior of this interceptor by passing a second argument including one or more of the methods demonstrated below:\n\n```javascript\nclient.interceptors.response.use(null, retry(client, {\n  // Determine when we should attempt to retry\n  isRetryable (error) {\n    return (\n      error.response \u0026\u0026 error.response.status === 429 \u0026\u0026\n      // Use X-Retry-After rather than Retry-After, and cap retry delay at 60 seconds\n      error.response.headers['x-retry-after'] \u0026\u0026 error.response.headers['x-retry-after'] \u003c= 60\n    )\n  }\n\n  // Customize the wait behavior\n  wait (error) {\n    return new Promise(\n      // Use X-Retry-After rather than Retry-After \n      resolve =\u003e setTimeout(resolve, error.response.headers['x-retry-after'])\n    )\n  }\n\n  // Customize the retry request itself\n  retry (axios, error) {\n    if (!error.config) {\n      throw error\n    }\n\n    // Apply request customizations before retrying\n    // ...\n\n    return axios(error.config)\n  }\n}))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Faxios-retry-after","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompwright%2Faxios-retry-after","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompwright%2Faxios-retry-after/lists"}