{"_id":"@aevaldas/axios-retry","_rev":"2-11edd36b6d32a00cb152c8f29bd8b618","name":"@aevaldas/axios-retry","dist-tags":{"latest":"3.1.3"},"versions":{"3.1.2":{"name":"@aevaldas/axios-retry","version":"3.1.2","author":{"name":"Rubén Norte","email":"ruben.norte@softonic.com"},"description":"Axios plugin that intercepts failed requests and retries them whenever posible.","license":"Apache-2.0","main":"index.js","homepage":"https://github.com/softonic/axios-retry","scripts":{"lint":"eslint es/**/*.js spec/**/*.spec.js","pretest":"npm run lint","test":"jasmine","prebuild":"npm run test","build":"rm -rf lib && babel es -d lib --source-maps","prerelease":"npm run build","release":"npm version -m \"New version: %s\"","postrelease":"npm run push && npm publish","push":"git push origin master && git push origin --tags","precommit":"lint-staged"},"lint-staged":{"*.+(js|jsx|scss)":["prettier --write","git add"]},"dependencies":{"is-retry-allowed":"^1.1.0"},"devDependencies":{"axios":"^0.15.2","babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","babel-register":"^6.9.0","eslint":"^4.4.1","eslint-config-airbnb-base":"^11.3.1","eslint-config-prettier":"^2.9.0","eslint-plugin-import":"^2.7.0","eslint-plugin-jasmine":"^1.8.1","eslint-plugin-prettier":"^2.6.0","husky":"^0.14.3","jasmine":"^2.4.1","lint-staged":"^7.1.2","nock":"^8.0.0","prettier":"^1.12.1"},"repository":{"type":"git","url":"git+https://github.com/softonic/axios-retry.git"},"bugs":{"url":"https://github.com/softonic/axios-retry/issues"},"typings":"./index.d.ts","gitHead":"322dda5258b9f58177656d9753915b5ccfaf860e","_id":"@aevaldas/axios-retry@3.1.2","_nodeVersion":"12.12.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-8Fpl9/Z9NjumHkQgzqi6kR7peTyhn6MVw10n4jPIvJa428H3DwGRzg93+mKbCFHZdWNUHvqXlK/WWRJxD+zA9g==","shasum":"662fa9e7e346acd5423f8644cb4453c89a6c2b5c","tarball":"https://registry.npmjs.org/@aevaldas/axios-retry/-/axios-retry-3.1.2.tgz","fileCount":7,"unpackedSize":18020,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRWlsCRA9TVsSAnZWagAAcSgP/iJNPebHoxtoyMV9/rUF\n1cUuDQRDz4HALJapLUInktBQIZKhyLF3K8DS8G1IR0ssZYaVooaU8BOhICsl\nMBhoZ9v6kDc0JNl2rhpiTnc3DqgfgUL1JhkOcq7QgCMk9POZaHC5zyBEki8F\nx1z3XP/CE8oiKhIn2w+B5KGJgqRjNo2ZLSAnKq2Pl7w4MP+TnXmraVAaoxfj\nc56bm75Lu7/+n3qmhOdIpvYvHlJE5gpnD5N76Llm/xUqJXB8NqhmRR8EecDl\nRRx/Oi9wuW9bNxr2juV3qPVxqW/PdbaPFbzC1TC8smxU+PA9Z4O18/GctHzc\nZVLJLOx8bk63wONw9vvo8cDqrLmlFvfoQQaP8k4e9O/Ma0p8OR7UrmJMs9w+\nMfC6BtsGjTkPNsrg5QM8gz35HoZ72LdRqsYsk+8BJ01h5T0SHxV+nEr21OVS\n6tdH+f/VH4MrWdzTQNP3BGUlFKW55STWI94qYNI/UZCDS1SBnSF8rRP3c8ri\nRDuzmtkVHNZnRkNjTNX5gMh9a0u8bj+gki8XKd9H/EKg9+XCvIZ3hEfOSQVx\nbD4Tz5ZIa8I4A7CI5dTOGJAkl4zyLjM5mT4uV1S5ZSHJf/UbV/ZhKhcl5Aus\nMzgKnZzjMDwaADsi/dXryk7CEZ6kR0pzxs0+/NHlxLvOcl8H9fpnz055S70T\nDlyK\r\n=Jj0K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBc9NoKr0brjB61ZO2slZ/iWne+YuQqcGMkf5cO1837yAiAFmJk34qQ9EmTndQdJN0LrWJv6a3BonFafsc3aU4gXfw=="}]},"maintainers":[{"name":"aevaldas","email":"evaldas.alcauskis@gmail.com"}],"_npmUser":{"name":"aevaldas","email":"evaldas.alcauskis@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-retry_3.1.2_1581607274996_0.8230530122655766"},"_hasShrinkwrap":false},"3.1.3":{"name":"@aevaldas/axios-retry","version":"3.1.3","author":{"name":"Rubén Norte","email":"ruben.norte@softonic.com"},"description":"Axios plugin that intercepts failed requests and retries them whenever posible.","license":"Apache-2.0","main":"index.js","homepage":"https://github.com/softonic/axios-retry","scripts":{"lint":"eslint es/**/*.js spec/**/*.spec.js","pretest":"npm run lint","test":"jasmine","prebuild":"npm run test","build":"rm -rf lib && babel es -d lib --source-maps","prerelease":"npm run build","release":"npm version -m \"New version: %s\"","postrelease":"npm run push && npm publish","push":"git push origin master && git push origin --tags","precommit":"lint-staged"},"lint-staged":{"*.+(js|jsx|scss)":["prettier --write","git add"]},"dependencies":{"is-retry-allowed":"^1.1.0"},"devDependencies":{"axios":"^0.15.2","babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","babel-register":"^6.9.0","eslint":"^4.4.1","eslint-config-airbnb-base":"^11.3.1","eslint-config-prettier":"^2.9.0","eslint-plugin-import":"^2.7.0","eslint-plugin-jasmine":"^1.8.1","eslint-plugin-prettier":"^2.6.0","husky":"^0.14.3","jasmine":"^2.4.1","lint-staged":"^7.1.2","nock":"^8.0.0","prettier":"^1.12.1"},"repository":{"type":"git","url":"git+https://github.com/softonic/axios-retry.git"},"bugs":{"url":"https://github.com/softonic/axios-retry/issues"},"typings":"./index.d.ts","gitHead":"322dda5258b9f58177656d9753915b5ccfaf860e","_id":"@aevaldas/axios-retry@3.1.3","_nodeVersion":"12.12.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-HunPTpvfoiP5FJwQv7PrNOoHGjzSyjM3sWwJkRs4sfWvEcfKiO8GwZXPP5D+l3kdkJif8IWoT9PSvYIoGMweeg==","shasum":"fb9f0b0bc539b8e1276f692b4d4a204591c65c17","tarball":"https://registry.npmjs.org/@aevaldas/axios-retry/-/axios-retry-3.1.3.tgz","fileCount":9,"unpackedSize":42904,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeRWykCRA9TVsSAnZWagAABzkP/RW4zui7N2ZcTq9JpMmi\nAD78eGLTEwNSaflie3Jdhl2Yjg4TWnQzo4XCYnyY6zn30EZOxHlfYkBoXrCU\nNCoDEQhqmrMoFi9lKT3ht5eSg91bcarG5ThIF6gwDeDOJFprB2YwAbZ+GfET\nMiajD26+XDi5cNCi4DEeW67VjCmZq79ILU4BYkiHKVmcQmQlgcD5dpwRjPsa\n1jQCXMudLTfl7QxDBX97Y45IdMUKv2UHFyqqMUzP/JXQRJObGHM7327IRxa4\nNMc84MOOVSAaeW8YHymbPTKojSjv5DHTgw+KDnFu3KhPoRMupoMerGrS1rtk\nDI8ZzXhC3XCh3G/lZf/7asPOindakAaDzAJrrCZuQoFKJZINfET89toGVgKr\ncxMW7I5xBssejRO+fInzeGNHXDG0XQNHDD2jEvocig8osaGSuEprR245n2ak\nsrzxKbxeV3FozjNr8qINDhJ2UIIPsSHWSFp512kFCc9LG1JSl2uvfN70BZNd\nJb7y2dJBKvK914edSGN6u7ZW599WxaXbvLLcSfmNwgcyFkvnGwVdZvh4C1Eo\nrjQebxBtE5vcKkKE5dq9Z1idLs8QiKbPJHiEehRj8yIlZZFusSrkZNPSYM/o\nJtN0dAwjdNXfAGhaC9D8mPDA/zkbRwg9VqxxRArS8kJfw1GPL4lHp2Tv4cyX\ndouX\r\n=zdH0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtVY+Sybiv1sC40UT8nsaAWgLH8k7HGGDrMgOo2rMjeAIgZ4XxZupDxWlnF6tXOCDaX8rPMKYSbrdQPSrq7CjvP80="}]},"maintainers":[{"name":"aevaldas","email":"evaldas.alcauskis@gmail.com"}],"_npmUser":{"name":"aevaldas","email":"evaldas.alcauskis@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-retry_3.1.3_1581608100117_0.5455364118651138"},"_hasShrinkwrap":false}},"time":{"created":"2020-02-13T15:21:14.946Z","3.1.2":"2020-02-13T15:21:15.134Z","modified":"2022-04-04T11:49:57.407Z","3.1.3":"2020-02-13T15:35:00.233Z"},"maintainers":[{"name":"aevaldas","email":"evaldas.alcauskis@gmail.com"}],"description":"Axios plugin that intercepts failed requests and retries them whenever posible.","homepage":"https://github.com/softonic/axios-retry","repository":{"type":"git","url":"git+https://github.com/softonic/axios-retry.git"},"author":{"name":"Rubén Norte","email":"ruben.norte@softonic.com"},"bugs":{"url":"https://github.com/softonic/axios-retry/issues"},"license":"Apache-2.0","readme":"# axios-retry\n\n[![Build Status](https://travis-ci.org/softonic/axios-retry.svg?branch=master)](https://travis-ci.org/softonic/axios-retry)\n\nAxios plugin that intercepts failed requests and retries them whenever possible.\n\n## Installation\n\n```bash\nnpm install axios-retry\n```\n\n### Note\nNot working with `axios 0.19.0`. For details see the [bug](https://github.com/axios/axios/issues/2203). [`axios 0.19.1`](https://github.com/axios/axios/releases/tag/0.19.1) has fixed this bug.\n\n## Usage\n\n```js\n// CommonJS\n// const axiosRetry = require('axios-retry');\n\n// ES6\nimport axiosRetry from 'axios-retry';\n\naxiosRetry(axios, { retries: 3 });\n\naxios.get('http://example.com/test') // The first request fails and the second returns 'ok'\n  .then(result => {\n    result.data; // 'ok'\n  });\n\n// Exponential back-off retry delay between requests\naxiosRetry(axios, { retryDelay: axiosRetry.exponentialDelay});\n\n// Custom retry delay\naxiosRetry(axios, { retryDelay: (retryCount) => {\n  return retryCount * 1000;\n}});\n\n// Works with custom axios instances\nconst client = axios.create({ baseURL: 'http://example.com' });\naxiosRetry(client, { retries: 3 });\n\nclient.get('/test') // The first request fails and the second returns 'ok'\n  .then(result => {\n    result.data; // 'ok'\n  });\n\n// Allows request-specific configuration\nclient\n  .get('/test', {\n    'axios-retry': {\n      retries: 0\n    }\n  })\n  .catch(error => { // The first request fails\n    error !== undefined\n  });\n\n// Allows retries on status-code-200 responses to work around poorly-written APIs\n/**\n * @returns {boolean}\n **/\nconst shouldRetrySuccessResponse = (responseBody) => {\n  return responseBody.errorMessage && responseBody.errorMessage.includes('too many requests');\n};\n\naxiosRetry(client, { shouldRetrySuccessResponse });\n\nclient.get('/test')  // Retries until shouldRetrySuccessResponse returns false or another no-retry condition is met\n  .then(result => {\n    result.data; // 'ok'\n  });\n```\n\n**Note:** Unless `shouldResetTimeout` is set, the plugin interprets the request timeout as a global value, so it is not used for each retry but for the whole request lifecycle.\n\n## Options\n\n| Name | Type | Default | Description |\n| --- | --- | --- | --- |\n| retries | `Number` | `3` | The number of times to retry before failing. |\n| retryCondition | `Function` | `isNetworkOrIdempotentRequestError` | A callback to further control if a request should be retried.  By default, it retries if it is a network error or a 5xx error on an idempotent request (GET, HEAD, OPTIONS, PUT or DELETE). |\n| retryDelay | `Function` | `function noDelay() { return 0; }` | A callback to further control the delay between retried requests. By default there is no delay between retries. Another option is exponentialDelay ([Exponential Backoff](https://developers.google.com/analytics/devguides/reporting/core/v3/errors#backoff)). The function is passed `retryCount` and `error`. |\n| shouldResetTimeout | `Boolean` | false | Defines if the timeout should be reset between retries |\n| shouldRetrySuccessResponse | `Function` | `function shouldRetrySuccessResponse() { return false; }` | A function to control if a response with a 200 status code should be retried.  Useful when you need to use APIs that send 200 status codes when an error status code (e.g. 429) is more appropriate. The function is passed the server's response body (not the entire response; just the [HTTP response body](https://developer.mozilla.org/en-US/docs/Web/HTTP/Messages#Body_2)).  |  \n\n## Testing\n\nClone the repository and execute:\n\n```bash\nnpm test\n```\n\n## Contribute\n\n1. Fork it: `git clone https://github.com/softonic/axios-retry.git`\n2. Create your feature branch: `git checkout -b feature/my-new-feature`\n3. Commit your changes: `git commit -am 'Added some feature'`\n4. Check the build: `npm run build`\n4. Push to the branch: `git push origin my-new-feature`\n5. Submit a pull request :D\n","readmeFilename":"README.md"}