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, HttpClientCall>

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
fun HttpResponse.close()
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.features.HttpPlainText settings will be used.

Link copied to clipboard
fun HttpResponse.use(block: () -> Unit)
fun <T> HttpStatement.use(block: suspend (response: HttpResponse) -> T)

Properties

Link copied to clipboard
val HttpResponse.request: HttpRequest

HttpRequest associated with this response.

Link copied to clipboard
val HttpResponse.response: HttpResponse
Link copied to clipboard
val HttpStatement.response: HttpResponse