close

open fun close()

Closes the underlying HTTP client and releases its resources.

Calling this method is usually unnecessary — the underlying HTTP client automatically releases threads and connections if they remain idle. Call this only if you need to aggressively free resources (e.g. during application shutdown).

Blocking: on some Ktor engines (notably CIO) this may block the calling thread while in-flight requests and the engine's internal coroutines finish. Prefer closeAndJoin from a coroutine context to avoid blocking.

The client cannot be reused after close is called.