WeTransfer/wt-js-sdk

Deal with rate limits when sending requests to Public API

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
The Public API throttles the requests, throwing a 429 error if the limit is reached at some point. Right now, we just pass the error to the client, but we should take care of it and retry the request again.

Since we use axios as a request library, we could write an interceptor or use an already existent library like axios-retry. Either way, we should give the client the possibility to configure the number of retries and the delay between retries.

Describe the solution you'd like
The SDK should retry at least 429 errors returned by the API, and most probably failures for network timeouts.