ktor-client-core / io.ktor.client.response / HttpResponse

HttpResponse

class HttpResponse : CoroutineScope, HttpMessage
Deprecated: Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.

Constructors

<init>

HttpResponse()

Properties

coroutineContext

val coroutineContext: <ERROR CLASS>

headers

val headers: Headers

Extension Functions

discardRemaining

suspend fun HttpResponse.discardRemaining(): Unit

Efficiently discards the remaining bytes of HttpResponse.content.

mapEngineExceptions

fun CoroutineScope.mapEngineExceptions(input: ByteReadChannel, request: HttpRequestData): ByteReadChannel

Returns ByteReadChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException.

fun CoroutineScope.mapEngineExceptions(output: ByteWriteChannel, request: HttpRequestData): ByteWriteChannel

Returns ByteWriteChannel with ByteChannel.close handler that returns SocketTimeoutException instead of SocketTimeoutException.

readBytes

suspend fun HttpResponse.readBytes(count: Int): ByteArray

Exactly reads count bytes of the HttpResponse.content.

suspend fun HttpResponse.readBytes(): ByteArray

Reads the whole HttpResponse.content if Content-Length was specified. Otherwise it just reads one byte.

readText

suspend fun HttpResponse.readText(charset: <ERROR CLASS>? = null): String