HTTPClient

public class HTTPClient : NetworkClient

An HTTP client that sends URLRequests via a URLSession.

URLRequests are sent as is and are retried according to the RequestInterceptors logic when necessary. RequestInterceptors are also notified of other events concerning the request lifecycle. Some of these events are related to the HTTPClient logic and some are just URLSessionDelegate events being forwarded.

You should almost never create a new instance of this class but rather use the shared instance, as it’s configured with sensible defaults and using one URLSession comes with a series of optimizations. If you need to create a new instance make sure to start from a default configuration and only add new interceptors to the default ones.