{"id":16736251,"url":"https://github.com/flexdinesh/axios-retry-interceptor","last_synced_at":"2025-10-17T19:29:05.692Z","repository":{"id":66288836,"uuid":"121435021","full_name":"flexdinesh/axios-retry-interceptor","owner":"flexdinesh","description":"Configurable Axios Interceptor to retry failed http calls.","archived":false,"fork":false,"pushed_at":"2019-04-04T22:28:06.000Z","size":17,"stargazers_count":18,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-27T22:16:40.438Z","etag":null,"topics":["axios","http","interceptor","middleware","retry","retry-library"],"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/flexdinesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2018-02-13T20:49:30.000Z","updated_at":"2024-06-21T16:52:18.121Z","dependencies_parsed_at":null,"dependency_job_id":"adcd5733-6a45-4ba6-953a-478912436e20","html_url":"https://github.com/flexdinesh/axios-retry-interceptor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexdinesh%2Faxios-retry-interceptor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexdinesh%2Faxios-retry-interceptor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexdinesh%2Faxios-retry-interceptor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexdinesh%2Faxios-retry-interceptor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexdinesh","download_url":"https://codeload.github.com/flexdinesh/axios-retry-interceptor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122701,"owners_count":20564358,"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":["axios","http","interceptor","middleware","retry","retry-library"],"created_at":"2024-10-13T00:08:49.484Z","updated_at":"2025-10-17T19:29:00.663Z","avatar_url":"https://github.com/flexdinesh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Axios Retry Interceptor\n[![Build Status](https://travis-ci.org/flexdinesh/axios-retry-interceptor.svg?branch=master)](https://travis-ci.org/flexdinesh/axios-retry-interceptor)\n[![dependencies Status](https://david-dm.org/flexdinesh/axios-retry-interceptor/status.svg)](https://david-dm.org/flexdinesh/axios-retry-interceptor)\n[![npm version](https://badge.fury.io/js/axios-retry-interceptor.svg)](https://www.npmjs.com/package/axios-retry-interceptor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nConfigurable Axios Interceptor to retry failed http calls.\n\n## Install\n\n```\nnpm install --save axios-retry-interceptor\n```\n\n## Usage\n\nImport\n```js\nimport retryInterceptor from 'axios-retry-interceptor';\n// or\nconst retryInterceptor = require('axios-retry-interceptor');\n```\n\nSet the interceptor for your axios instance. Voila! ✨\n```js\nretryInterceptor(axios, {\n  maxAttempts: 3,\n  waitTime: 1000\n});\n\n```\n\n## API\n\n### retryInterceptor(axiosInstance, options)\n\n- axiosInstance - your axios instance\n- options - config for retry interceptor\n\n### Options\n\n#### maxAttempts\n\nMax number of times the interceptor should retry the failed http call.\n\n_Type_: Number\n\n_Default_: 3\n\n_Example_: `maxAttempts: 5`\n\n#### waitTime\n\nDuration between each retry attempt in milliseconds(1s=1000ms).\n\n_Type_: Number\n\n_Default_: 0\n\n_Example_: `waitTime: 3000`\n\n#### errorCodes\n\nResponse errorCodes for which the interceptor should retry.\n\nIdeally any implementation should retry only 5xx status(server errors) and should not retry 4xx status(client errors). The reason is, if a http call fails with a client error, then the retry call will have the same headers/params and will obviously fail. So **by default all 5xx errors will be retried**. If you want to customize the status for which the retries should be made, use this config.\n\n_Type_: Array\n\n_Default_: []\n\n_Example_: `errorCodes: [500, 501, 401]`\n\n## Author's note\n\nIdeally only idempotent http methods (GET, PUT, DELETE, HEAD, OPTIONS) should be retried on failed http calls. Non-idempotent methods like POST should **NOT** be retried and that's why this library will not permit retry of non-idempotent methods.\n\n## License\n\nMIT © Dinesh Pandiyan\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexdinesh%2Faxios-retry-interceptor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexdinesh%2Faxios-retry-interceptor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexdinesh%2Faxios-retry-interceptor/lists"}