microsoft/SimpleRestClients

Retry logic exclude client request error

SeriousJul opened this issue · 2 comments

Hi!

There is a condition in SimpleWebRequest to ignore retry in case the client request failed.
https://github.com/Microsoft/SimpleRestClients/blob/218e9f179b91bc0da65d59f5b162d233b7c54734/src/SimpleWebRequest.ts#L616

IMHO you might want to retry in that case. Especially on mobile devices when the network switch from Wifi to 4G, the connection is often reset by the device, resulting in httpCode == 0.

What is your opinion about it ?

That's fair enough -- that code was around from long before custom retry policies, so if we just make the default policy an immediate reject of statusCode === 0, then you can apply custom logic in a custom retry policy, and it won't break back-compat. Feel free to submit a PR that does this.

Duplicate of #11