AnyHttpService

public struct AnyHttpService : HttpService

This entity provides a way to initialize an HTTP service without implementing the HttpService protocol in a custom entity. Note that you should usually implement the HttpService protocol instead of simply using an instance of AnyHttpService. This class is mainly used internally.

Properties

Initialization

  • Initializes a new HTTP service while setting all parameters as provided.

    Declaration

    Swift

    public init(at url: UrlConvertible,
                header: HttpHeader = [:],
                sessionConfiguration: URLSessionConfiguration = .default,
                retrierFactory: RetrierFactory = NilRetrier.factory(),
                processError: @escaping (Squid.Error) -> Void = { _ in })

    Parameters

    url

    The URL of the API represented by the HTTP service.

    header

    The header fields shared among all requests. Defaults to no fields.

    sessionConfiguration

    The session configuration to use for all requests. Defaults to URLSessionConfiguration.default.

    retrierFactory

    An instance of a retrier factory to generate retriers from.

    processError

    A closure to execute on request errors.