Package io.ktor.client.statement

Types

Link copied to clipboard
class DefaultHttpResponse(call: HttpClientCall, responseData: HttpResponseData) : HttpResponse
Link copied to clipboard
class HttpReceivePipeline(developmentMode: Boolean) : Pipeline<HttpResponse, Unit>

HttpClient Pipeline used for receiving HttpResponse without any processing.

Link copied to clipboard
abstract class HttpResponse : HttpMessage, CoroutineScope

A response for HttpClient, second part of HttpClientCall.

Link copied to clipboard
data class HttpResponseContainer(expectedType: TypeInfo, response: Any)

Class representing a typed response with an attached expectedType.

Link copied to clipboard
class HttpResponsePipeline(developmentMode: Boolean) : Pipeline<HttpResponseContainer, HttpClientCall>

HttpClient Pipeline used for executing HttpResponse.

Link copied to clipboard
class HttpStatement(builder: HttpRequestBuilder, client: HttpClient)

Prepared statement for http client request. This statement doesn't perform any network requests until execute method call.

Functions

Link copied to clipboard
suspend fun HttpResponse.bodyAsChannel(): ByteReadChannel
Link copied to clipboard
suspend fun HttpResponse.bodyAsText(fallbackCharset: Charset = Charsets.UTF_8): String

Read the HttpResponse.content as a String. You can pass an optional charset to specify a charset in the case no one is specified as part of the Content-Type response. If no charset specified either as parameter or as part of the response, io.ktor.client.plugins.HttpPlainText settings will be used.

Link copied to clipboard
suspend fun HttpResponse.discardRemaining()

Efficiently discards the remaining bytes of HttpResponse.content.

Link copied to clipboard
suspend fun HttpResponse.readBytes(): ByteArray

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

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

Exactly reads count bytes of the HttpResponse.content.

Link copied to clipboard
suspend fun HttpResponse.readText(fallbackCharset: Charset? = null): String

Read the HttpResponse.content as a String. You can pass an optional charset to specify a charset in the case no one is specified as part of the Content-Type response. If no charset specified either as parameter or as part of the response, io.ktor.client.plugins.HttpPlainText settings will be used.

Link copied to clipboard
inline suspend fun <T> HttpStatement.receive(): T

Executes this statement and run HttpClient.responsePipeline with the response and expected type T.

inline suspend fun <T, R> HttpStatement.receive(crossinline block: suspend (T) -> R): R

Executes this statement and run the block with a HttpClient.responsePipeline execution result.

Properties

Link copied to clipboard
val HttpResponse.request: HttpRequest

HttpRequest associated with this response.