RequestRetrier

open class RequestRetrier : RequestRetrierProtocol, @unchecked Sendable

默认请求重试器,直接调用request的钩子方法

  • Undocumented

    Declaration

    Swift

    public static let `default`: RequestRetrier
  • 自定义重试过滤器,回调过滤结果(nil时继续判定,非nil时停止判定),优先级最高且线程安全,可用于刷新授权等

    Declaration

    Swift

    open var requestRetryFilter: (@Sendable (_ request: HTTPRequest, _ response: URLResponse, _ responseObject: Any?, _ error: Error?, _ completionHandler: @escaping @Sendable (_ filterResult: Bool?) -> Void) -> Void)?
  • Undocumented

    Declaration

    Swift

    public init()

Public

  • 同步执行自定义重试句柄,必须调用completionHandler,线程安全

    Declaration

    Swift

    open func retrySynchronously(_ block: @escaping @Sendable (_ completionHandler: @escaping () -> Void) -> Void)

RequestRetrierProtocol