Classes
The following classes are available globally.
-
Configuration class for HTTP client instances.
HttpClientConfigprovides 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:
See morelet 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)") }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 moreDeclaration
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
URLRequestfor 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 moreDeclaration
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 moreDeclaration
Swift
public final class URLSessionHttpResponse : HttpResponse, @unchecked Sendable
View on GitHub
Classes Reference