Package io.ktor.client.utils

Types

Link copied to clipboard
class ByteBufferPool : DefaultPool<ByteBuffer>
Link copied to clipboard
object CacheControl

List of CacheControl known values.

Link copied to clipboard
object EmptyContent : OutgoingContent.NoContent

Concrete OutgoingContent without a payload.

Link copied to clipboard
class HttpResponseReceiveFail(response: HttpResponse, cause: Throwable)

Utility class containing response and fail reasons for an HttpResponseReceiveFailed event.

Functions

Link copied to clipboard
fun buildHeaders(block: HeadersBuilder.() -> Unit = {}): Headers

Builds an instance of Headers using the block function.

Link copied to clipboard
expect fun Dispatchers.clientDispatcher(threadCount: Int, dispatcherName: String = "ktor-client-dispatcher"): CoroutineDispatcher

Creates CoroutineDispatcher for client with fixed threadCount and specified dispatcherName.

actual fun Dispatchers.clientDispatcher(threadCount: Int, dispatcherName: String = "ktor-client-dispatcher"): CoroutineDispatcher

Creates CoroutineDispatcher for client with fixed threadCount and specified dispatcherName.

actual fun Dispatchers.clientDispatcher(threadCount: Int, dispatcherName: String = "ktor-client-dispatcher"): CoroutineDispatcher

Creates CoroutineDispatcher based on thread pool of threadCount threads.

actual fun Dispatchers.clientDispatcher(threadCount: Int, dispatcherName: String = "ktor-client-dispatcher"): CoroutineDispatcher

Creates CoroutineDispatcher for client with fixed threadCount and specified dispatcherName.

Link copied to clipboard
expect fun Throwable.unwrapCancellationException(): Throwable

If the exception contains cause that differs from CancellationException returns it otherwise returns itself.

actual fun Throwable.unwrapCancellationException(): Throwable

If the exception contains cause that differs from CancellationException returns it otherwise returns itself.

actual fun Throwable.unwrapCancellationException(): Throwable

If the exception contains cause that differs from CancellationException returns it otherwise returns itself.

actual fun Throwable.unwrapCancellationException(): Throwable

If the exception contains cause that differs from CancellationException returns it otherwise returns itself.

Link copied to clipboard
fun OutgoingContent.wrapHeaders(block: (Headers) -> Headers): OutgoingContent

Generates a new OutgoingContent of the same abstract type but with OutgoingContent.headers transformed by the specified block.

Properties

Link copied to clipboard
const val DEFAULT_HTTP_BUFFER_SIZE: Int = 4096

Size of each buffer in the HttpClientDefaultPool.

Link copied to clipboard
const val DEFAULT_HTTP_POOL_SIZE: Int = 1000

Maximum number of buffers to be allocated in the HttpClientDefaultPool.

Link copied to clipboard
val HttpClientDefaultPool: ByteBufferPool

Singleton pool of ByteBuffer objects used for HttpClient.

Link copied to clipboard
val HttpRequestCreated: EventDefinition<HttpRequestBuilder>

Occurs after the creation of a new request

Link copied to clipboard

Occurs before sending the request, and after execution of all interceptors.

Link copied to clipboard
val HttpResponseCancelled: EventDefinition<HttpResponse>

Occurs when the response is cancelled due to an exception.

Link copied to clipboard
val HttpResponseReceived: EventDefinition<HttpResponse>

Occurs after responses headers have been received.

Link copied to clipboard

Occurs when an exception is thrown during receiving of body.