HTTPClient

public protocol HTTPClient

Protocol HTTPClient

  • Send the given request. The request will be processed by the list of Interceptors.

    Declaration

    Swift

    @available(*, deprecated, message: "Use async version instead")
    func sendPublisher(request: URLRequest, interceptors: [Interceptor], redirect handler: RedirectHandler?)
        -> AnyPublisher<HTTPResponse, HTTPClientError>

    Parameters

    request

    The request to be (modified and) sent.

    interceptors

    per request interceptors.

    handler

    handler that should be called in case of redirect.

    Return Value

    AnyPublisher that emits a response as HTTPResponse

  • Send the given request. The request will be processed by the list of Interceptors.

    Note

    Only HTTPClientErrors are supposed to be thrown.

    Declaration

    Swift

    func sendAsync(
        request: URLRequest,
        interceptors: [Interceptor],
        redirect handler: RedirectHandler?
    ) async throws -> HTTPResponse

    Parameters

    request

    The request to be (modified and) sent.

    interceptors

    per request interceptors.

    handler

    handler that should be called in case of redirect.

    Return Value

    The response as HTTPResponse

  • List of all active interceptors of the HTTP client.

    Declaration

    Swift

    var interceptors: [Interceptor] { get }
  • Send the given request. The request will be processed by the list of Interceptors.

    Declaration

    Swift

    @available(*, deprecated, message: "Use async version instead")
    public func sendPublisher(request: URLRequest,
                              interceptors: [Interceptor]) -> AnyPublisher<HTTPResponse, HTTPClientError>

    Parameters

    request

    The request to be (modified and) sent.

    interceptors

    per request interceptors.

    Return Value

    AnyPublisher that emits a response as HTTPResponse

  • sendPublisher(request:) Extension method

    Send the given request.

    Declaration

    Swift

    @available(*, deprecated, message: "Use async version instead")
    public func sendPublisher(request: URLRequest) -> AnyPublisher<HTTPResponse, HTTPClientError>

    Parameters

    request

    The request to be (modified and) sent.

    Return Value

    AnyPublisher that emits a response as HTTPResponse

  • sendAsync(request:interceptors:) Extension method, asynchronous

    Send the given request. The request will be processed by the list of Interceptors.

    Note

    Only HTTPClientErrors are supposed to be thrown.

    Declaration

    Swift

    public func sendAsync(request: URLRequest, interceptors: [Interceptor]) async throws -> HTTPResponse

    Parameters

    request

    The request to be (modified and) sent.

    interceptors

    per request interceptors.

    Return Value

    The response as HTTPResponse

  • sendAsync(request:) Extension method, asynchronous

    Send the given request. The request will be processed by the list of Interceptors.

    Note

    Only HTTPClientErrors are supposed to be thrown.

    Declaration

    Swift

    public func sendAsync(request: URLRequest) async throws -> HTTPResponse

    Parameters

    request

    The request to be (modified and) sent.

    Return Value

    The response as HTTPResponse