It's always good to give some more chances to the same action, this can easily be achieved by wrapping the request calls :
We can use the indirection offered by std::function
, so that the request and the on_response handler can respectively refers each other.
Now we can write an on_response handler which will calls the request again if it failed and there are still retries_count
available.