ktor-client-core / io.ktor.client.call

Package io.ktor.client.call

Types

HttpClientCall

open class HttpClientCall : CoroutineScope

A class that represents a single pair of request and response for a specific HttpClient.

Exceptions

DoubleReceiveException

class DoubleReceiveException : IllegalStateException

Exception representing that the response payload has already been received.

NoTransformationFoundException

class NoTransformationFoundException : UnsupportedOperationException

Exception representing the no transformation was found. It includes the received type and the expected type as part of the message.

ReceivePipelineException

class ReceivePipelineException : IllegalStateException

Exception representing fail of the response pipeline cause contains origin pipeline exception

UnsupportedContentTypeException

class UnsupportedContentTypeException : IllegalStateException

UnsupportedUpgradeProtocolException

class UnsupportedUpgradeProtocolException : IllegalArgumentException

Functions

body

suspend fun <T> HttpClientCall.body(): T
suspend fun <T> HttpResponse.body(): T

Tries to receive the payload of the response as an specific type T.

suspend fun <T> HttpResponse.body(typeInfo: TypeInfo): T

Tries to receive the payload of the response as an specific type T described in typeInfo.

receive

suspend fun <T> HttpClientCall.receive(): T
suspend fun <T> HttpResponse.receive(): T

Tries to receive the payload of the response as an specific type T.

suspend fun receive(info: TypeInfo): Any

Tries to receive the payload of the response as a specific expected type provided in info. Returns response if info corresponds to HttpResponse.

save

suspend fun HttpClientCall.save(): HttpClientCall

Fetch data for HttpClientCall and close the origin.