RequestPluginImpl
open class RequestPluginImpl : NSObject, RequestPlugin, @unchecked Sendable
默认请求插件
-
单例模式
Declaration
Swift
@objc(sharedInstance) public static let shared: RequestPluginImpl
-
SessionConfiguration配置,默认nil
Declaration
Swift
open var sessionConfiguration: URLSessionConfiguration
-
自定义安全策略,默认default
Declaration
Swift
open var securityPolicy: SecurityPolicy
-
SessionTaskMetrics配置句柄,默认nil
Declaration
Swift
open var collectingMetricsBlock: (@Sendable (_ session: URLSession, _ task: URLSessionTask, _ metrics: URLSessionTaskMetrics?) -> Void)?
-
是否移除响应JSON中的NSNull值,默认true
Declaration
Swift
open var removeNullValues: Bool
-
有效状态码范围,默认为(100-600)
Declaration
Swift
open var acceptableStatusCodes: IndexSet
-
有效的contentType列表,默认nil不修改
Declaration
Swift
open var acceptableContentTypes: Set<String>?
-
管理器,延迟加载前可配置
Declaration
Swift
open lazy var manager: HTTPSessionManager { get set }
-
HTTP响应序列化
Declaration
Swift
open lazy var httpResponseSerializer: HTTPResponseSerializer { get set }
-
JSON响应序列化
Declaration
Swift
open lazy var jsonResponseSerializer: JSONResponseSerializer { get set }
-
Declaration
Swift
open func buildUrlRequest(for request: HTTPRequest) throws -> URLRequest
-
Declaration
Swift
open func startDataTask(for request: HTTPRequest, completionHandler: (@Sendable (URLResponse, Any?, Error?) -> Void)?)
-
Declaration
Swift
open func startDownloadTask(for request: HTTPRequest, resumeData: Data?, destination: String, completionHandler: (@Sendable (URLResponse, URL?, Error?) -> Void)?)
-
Declaration
Swift
open func suspendRequest(_ request: HTTPRequest)
-
Declaration
Swift
open func resumeRequest(_ request: HTTPRequest)
-
Declaration
Swift
open func cancelRequest(_ request: HTTPRequest)