AnalyticsNetworkRequestInterceptor.swift 653 Bytes
//
//  NetworkRequestInterceptor.swift
//  VPNAnalytics
//
//  Created by Mihail Konoplitskyi on 06.03.2023.
//

#if os(macOS)
    import Cocoa
#else
    import Foundation
#endif

import Alamofire

class AnalyticsNetworkRequestInterceptor: RequestInterceptor {
    func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
        let urlRequest = urlRequest
        completion(.success(urlRequest))
    }
    
    func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void) {
        completion(.doNotRetryWithError(error))
    }
}