-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
ApexyURLSession is very lightweight and useful. I want use Apexy without Alamofire in my case.
But, ApexyAlamofire has injected RequestInterceptor with method:
open func retry(
_ request: Request,
for session: Session,
dueTo error: Error,
completion: @escaping (RetryResult) -> Void)
Using this method very useful. What do you all think about an idea add a protocol RequestRetrier? It has enum RetryResult (copied from Alamofire):
/// Outcome of determination whether retry is necessary.
public enum RetryResult {
/// Retry should be attempted immediately.
case retry
/// Retry should be attempted after the associated `TimeInterval`.
case retryWithDelay(TimeInterval)
/// Do not retry.
case doNotRetry
/// Do not retry due to the associated `Error`.
case doNotRetryWithError(Error)
}
- Inject him in URLSessionClient init with default implementation
- When dataTask/uploadTask error catched, call recursively request/upload methods, when RetryResult equal retry/retryWithDelay
- In cases doNotRetry/doNotRetryWithError throw error
I want implement this behaviour, if active community members thinks that my proposal will be useful.
Metadata
Metadata
Assignees
Labels
No labels