Alamofire: RequestRetrier should method not calling

Created on 22 Sep 2016  路  3Comments  路  Source: Alamofire/Alamofire

I create a class conforming to RequestRetrier :

public class OAuth2Handler: RequestRetrier {
    public func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) {
        print("Hello")
    }
}

Later setup it:
Alamofire.SessionManager.default.retrier = OAuth2Handler()
let alamoReq = Alamofire.SessionManager.default.request(myRequest)

I try with errors 401 and 404 and should method never called. How to setup it right ?

Alamofire 4.0
iOS 10.0.1

Most helpful comment

Solution:
You should chain validate() to the request.

All 3 comments

@filippovdev,
Did you find a solution?
I'm with the same problem.

Solution:
You should chain validate() to the request.

Not working

Was this page helpful?
0 / 5 - 0 ratings