I'm posting this here because I couldn't find a good example/documentation on this subject. The official Supergent docs only say
This method has two optional arguments: number of retries (default 3) and a callback. It calls callback(err, res) before each retry. The callback may return true/false to control whether the request sould be retried (but the maximum number of retries is always applied).
I have the following questions regarding this functionality.
- What happens if there are no callback to the retry method eg:
request.retry();
how does it decide when to retry? - Does the
true/false
returned by the callback function decide whether to retry again? - Is there a way to skip retrying if the request failed with specific error type, say 5xx?
- How can you have an async function as the callback?
Thanks