HttpClientCall

open class HttpClientCall(val client: HttpClient) : CoroutineScope

A pair of a request and response for a specific HttpClient.

Constructors

Link copied to clipboard
constructor(client: HttpClient, requestData: HttpRequestData, responseData: HttpResponseData)
constructor(client: HttpClient)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Typed Attributes associated to this call serving as a lightweight container.

Link copied to clipboard

the client that executed the call.

Link copied to clipboard
Link copied to clipboard
lateinit var request: HttpRequest

The request sent by the client.

Link copied to clipboard
lateinit var response: HttpResponse

The response sent by the server.

Functions

Link copied to clipboard
suspend fun body(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.

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

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

Link copied to clipboard
suspend fun bodyNullable(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.

Link copied to clipboard

Saves the entire content of this HttpClientCall to memory and returns a new HttpClientCall with the content cached in memory. This can be particularly useful for caching, debugging, or processing responses without relying on the original network stream.

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

Wrap existing HttpClientCall with new response content and headers.

Link copied to clipboard