RequestInterceptor
public protocol RequestInterceptor : AnyObject
Protocol for intercepting and handling network requests and responses.
-
waitingForConnectivity(_:Default implementation) A
URLSessionTaskwas put on hold by theURLSessionwhile waiting for connectivity to come backDefault Implementation
Declaration
Swift
func waitingForConnectivity(_ task: URLSessionTask)Parameters
taskthe
URLSessionTaskthat was put on hold for connectivity -
didComplete(_:Default implementationwith: ) A
URLRequestwas completed with aNetworkResultThis event will be reported for each completed data task, which means that if a request is retried it might be reported more than once for each call.
Default Implementation
Declaration
Swift
func didComplete(_ request: URLRequest, with response: NetworkResult)Parameters
requestthe
URLRequestthat was completedresponsethe
NetworkResultthat was created with the response from the server or with the error -
shouldRetry(_:Default implementationretryCount: with: ) The client is asking if a given
URLRequestshould be retried.Default Implementation
Declaration
Swift
func shouldRetry(_ request: URLRequest, retryCount: Int, with response: NetworkResult) -> RetryPolicyParameters
requestthe
URLRequestto be retriedretryCountthe amount of retries that have already been sent so far
responsethe
NetworkResultfor the last request sent
View on GitHub