DefaultHttpResponse

Constructors

Link copied to clipboard
constructor(call: HttpClientCall, responseData: HttpResponseData)

Properties

Link copied to clipboard
open override val call: HttpClientCall

The associated HttpClientCall containing both the underlying HttpClientCall.request and HttpClientCall.response.

Link copied to clipboard

Provides a raw ByteReadChannel to the response content as it was read from the network. This content can be still compressed or encoded.

Link copied to clipboard
Link copied to clipboard
open override val headers: Headers
Link copied to clipboard
Link copied to clipboard
open override val rawContent: ByteReadChannel

Provides a raw ByteReadChannel to the response content as it is read from the network. This content can be still compressed or encoded.

Link copied to clipboard

Gets HttpRequest associated with this response.

Link copied to clipboard
open override val requestTime: GMTDate

GMTDate of the request start.

Link copied to clipboard
open override val responseTime: GMTDate

GMTDate of the response start.

Link copied to clipboard
open override val status: HttpStatusCode

The HttpStatusCode returned by the server. It includes both, the HttpStatusCode.description and the HttpStatusCode.value (code).

Link copied to clipboard

Functions

Link copied to clipboard
inline suspend fun <T> HttpResponse.body(): T

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

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

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

Link copied to clipboard

Reads the response body as a byte array. Note that all plugins will be applied to the response body, which may be decompressed or decoded.

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

Reads the HttpResponse.rawContent 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

Efficiently discards the remaining bytes of HttpResponse.rawContent.

Link copied to clipboard

Reads the raw payload of the HTTP response as a byte array.

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

Reads exactly count bytes of the HttpResponse.rawContent.

Link copied to clipboard

Reads the raw payload of the HTTP response as a byte array.

Link copied to clipboard
open override fun toString(): String