Classes

The following classes are available globally.

  • Configuration class for HTTP client instances.

    HttpClientConfig provides a DSL-style interface for configuring HTTP client behavior including timeouts, logging, and interceptors. Configure this once up front; it is not intended for concurrent mutation after use.

    Example:

    let config = HttpClientConfig()
    config.timeout = 30.0
    config.logger = LogManager.standard
    config.onRequest { request in
        request.setHeader(name: "Authorization", value: "Bearer \(token)")
    }
    config.onResponse { response in
        config.logger.d("Status \(response.status)")
    }
    
    See more

    Declaration

    Swift

    public final class HttpClientConfig
  • URLSession-based implementation of HttpClientProtocol.

    Applies request/response interceptors, injects standard headers, and prevents automatic redirects.

    This class is thread-safe and can be safely shared across multiple threads and async contexts. All mutable state is confined to the URLSession instance, which is itself thread-safe.

    Multiple concurrent requests can safely use the same client instance.

    See more

    Declaration

    Swift

    @objc
    public final class URLSessionHttpClient : NSObject, HttpClientProtocol, @unchecked Sendable
  • URLSession-based implementation of HttpRequest.

    This type accumulates headers, query parameters, cookies, and bodies before building a URLRequest for execution by the HTTP client.

    This class is NOT thread-safe. It contains mutable state without synchronization and should not be shared across multiple threads or modified concurrently.

    See more

    Declaration

    Swift

    public class URLSessionHttpRequest : HttpRequest, @unchecked Sendable
  • URLSession-based implementation of HttpResponse.

    This class is thread-safe and can be safely shared across threads.

    See more

    Declaration

    Swift

    public final class URLSessionHttpResponse : HttpResponse, @unchecked Sendable