             return
         }
         // Run default configuration of challenge:
-        let previousFailureCount = challenge.previousFailureCount
         // Cancel challenge if failed many times.
         guard challenge.previousFailureCount == 0 else {
             challenge.sender?.cancel(challenge)

    ///   - completionHandler: A block that your handler should call with either the value of the request parameter, 
    ///                        a modified URL request object, or NULL to refuse the redirect and return the body of the redirect response.
    public func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Swift.Void) {
        taskOfSessionWillPerformHTTPRedirection?(task, session, response, request, completionHandler)
    }
    /// Requests credentials from the delegate in response to an authentication request from the remote server.
    /// This method handles task-level authentication challenges. The URLSessionDelegate protocol also provides a session-level authentication

    ///                        version of that response, or NULL to prevent caching the response. If your delegate implements this method, 
    ///                        it must call this completion handler; otherwise, your app leaks memory.
    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse, completionHandler: @escaping (CachedURLResponse?) -> Swift.Void) {
        if let willCacheResponse = dataTaskOfSessionWillCacheResponse {
            willCacheResponse(dataTask, session, proposedResponse, completionHandler)
            return
        }
        
        completionHandler(proposedResponse)
    }
}

