Interceptor
public protocol InterceptorModifies URLRequests going out and the corresponding URLResponse coming back in.
Usage e.g. for manipulating header field of an existing request.
- 
                  
                  Intercept the chain (e.g. modify it’s request) Note A call tochain.proceed(request:)is critical when implementing this protocol function.DeclarationSwift @available(*, deprecated, message: "Use async version instead") func interceptPublisher(chain: Chain) -> AnyPublisher<HTTPResponse, HTTPClientError>Parameterschainrequest chain to be intercepted Return ValueAnyPublisherthat emits the response asHTTPClient.Response
- 
                  interceptAsync(chain:Asynchronous) Intercept the chain (e.g. modify it’s request) Note A call tochain.proceed(request:)is critical when implementing this protocol function.Note OnlyHTTPClientErrorare supposed to be thrown.DeclarationSwift func interceptAsync(chain: Chain) async throws -> HTTPResponseParameterschainrequest chain to be intercepted Return ValueResponse emitted as HTTPClient.Response
- 
                  intercept(chain:Extension method) Intercept the chain (e.g. modify it’s request) Note A call tochain.proceed(request:)is critical when implementing this protocol function.DeclarationSwift @available(*, deprecated, renamed: "interceptPublisher(chain:﹚", message: "Use async version instead") public func intercept(chain: Chain) -> AnyPublisher<HTTPResponse, HTTPClientError>Parameterschainrequest chain to be intercepted Return ValueAnyPublisherthat emits the response asHTTPClient.Response
 View on GitHub
            View on GitHub
           Interceptor Protocol Reference
      Interceptor Protocol Reference