RequestAdapter
public protocol RequestAdapter
A type that can inspect and optionally adapt a URLRequest in some manner if necessary.
-
Inspects and adapts the specified
URLRequestin some manner and calls the completion handler with the Result.Declaration
Swift
func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void)Parameters
urlRequestThe
URLRequestto adapt.sessionThe
Sessionthat will execute theURLRequest.completionThe completion handler that must be called when adaptation is complete.
-
adapt(_:Default implementationusing: completion: ) Inspects and adapts the specified
URLRequestin some manner and calls the completion handler with the Result.Default Implementation
Declaration
Swift
func adapt(_ urlRequest: URLRequest, using state: RequestAdapterState, completion: @escaping (Result<URLRequest, Error>) -> Void)Parameters
urlRequestThe
URLRequestto adapt.stateThe
RequestAdapterStateassociated with theURLRequest.completionThe completion handler that must be called when adaptation is complete.
-
adapter(using:Extension method) Creates an
Adapterusing the providedAdaptHandlerclosure.Declaration
Swift
public static func adapter(using closure: @escaping AdaptHandler) -> AdapterParameters
closureAdaptHandlerto use to adapt the request.Return Value
The
Adapter.
View on GitHub
Install in Dash
RequestAdapter Protocol Reference