Interceptor
public protocol Interceptor
Base Protocol for Interceptor.
Interceptors are able to intercept a request and a response..
-
intercept(_:Default implementation) # Summary Intercepting the request to create the ability to modify the
URLRequestbefore executing it. Example usages are adding request headers, authentication and request logging.Default Implementation
Declaration
Swift
func intercept(_ request: URLRequest) -> URLRequestParameters
requestThe request to be intercepted.
Return Value
The intercepted and modified request.
-
intercept(response:Default implementationdata: error: ) # Summary Intercepting the response to add the ability to modify a response of a request. Additionally it is possible handle data and errors.
Default Implementation
Declaration
Swift
func intercept(response: URLResponse?, data: Data?, error: Error?) -> URLResponse?Parameters
responseThe response returned by the data task
dataThe data returned by the data task.
errorThe error returned by the data task.
Return Value
The intercepted and modified response.
View on GitHub
Install in Dash
Interceptor Protocol Reference