RequestPlugin
public protocol RequestPlugin : AnyObject
请求插件协议
-
buildUrlRequest(for:
Default implementation) 构建请求URLRequest
Default Implementation
默认实现构建请求URLRequest
Declaration
Swift
func buildUrlRequest(for request: HTTPRequest) throws -> URLRequest
-
startDataTask(for:
Default implementationcompletionHandler: ) 构建数据任务,自动开始
Default Implementation
默认实现构建数据任务,自动开始
Declaration
Swift
func startDataTask(for request: HTTPRequest, completionHandler: (@Sendable (URLResponse, Any?, Error?) -> Void)?)
-
startDownloadTask(for:
Default implementationresumeData: destination: completionHandler: ) 构建下载任务,支持断点续传,自动开始
Default Implementation
默认实现构建下载任务,支持断点续传自动开始
Declaration
Swift
func startDownloadTask(for request: HTTPRequest, resumeData: Data?, destination: String, completionHandler: (@Sendable (URLResponse, URL?, Error?) -> Void)?)
-
suspendRequest(_:
Default implementation) 暂停请求,开始后可调用
Default Implementation
默认实现暂停请求,开始后可调用
Declaration
Swift
func suspendRequest(_ request: HTTPRequest)
-
resumeRequest(_:
Default implementation) 继续请求,暂停后可调用
Default Implementation
默认实现继续请求,暂停后可调用
Declaration
Swift
func resumeRequest(_ request: HTTPRequest)
-
cancelRequest(_:
Default implementation) 取消请求
Default Implementation
默认实现取消请求
Declaration
Swift
func cancelRequest(_ request: HTTPRequest)