softonic / axios-retry

Axios plugin that intercepts failed requests and retries them whenever possible
Other
1.9k stars 167 forks source link

Make `onRetry` callback compatible with Promises #216

Closed mathieucoinmiles closed 1 year ago

mathieucoinmiles commented 2 years ago

Hi there!

I updated the onRetry callback to accept Promises both in JS and in TS. This was an issue for us, in our case, we are required to generate a bearer token using an asynchronous HTTPS request whenever there's a response with HTTP/401 (which just means the bearer token is expired ), we then update the authorization header with the request result. I added a test scenario where I do just the same thing.

I also added documentation & instruction on how to run/debug the project! Fixing the issue I previously created: #215

Let me know if there's anything not matching your guidelines!

The package is available here: https://www.npmjs.com/package/@coin-miles/axios-retry

Thanks! Looking forward to do more contributions!

RickardRanniger commented 1 year ago

I need this too, when will it be merged into master?

mindhells commented 1 year ago

Sorry for the late response, there are some reasons we cannot merge this PR:

mathieucoinmiles commented 1 year ago

This was an easy merge until you waited so long before looking at it, I won't make the effort to comply with the formatting or even resolve the git conflict, this PR has been open for a while, if you were more responsive you would have had no problem merging it. For now, at Coinmiles, we think it's less work for us if we simply keep our fork up to date