'axios-retry not working as expected. What is wrong with my config?
I have configured axios-retry in my nodejs application as per https://www.npmjs.com/package/axios-retry
Following is my code
import axios from 'axios';
import axiosRetry from 'axios-retry';
export class RetryRoute {
public async testRetry(
req: express.Request,
res: express.Response,
next: express.NextFunction,
): Promise<any> {
const client = axios.create({ baseURL: `http://www.test.com/` });
axiosRetry(axios, { retries: 3 });
client.get('/error')
.then(result => {
this.logger.info('success', result);
result.data;
}).catch(error => {
console.log('error', error.message);
error !== undefined
});
}
}
console.log('error', error.message);. prints as expected. which means call is failed with code 404 as expected. But next call from retry not happening.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
