HttpStatement

Prepared statement for a HTTP client request. This statement doesn't perform any network requests until execute method call. HttpStatement is safe to execute multiple times.

Example: Streaming data

Constructors

Link copied to clipboard

Functions

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

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

inline suspend fun <T, R> body(crossinline block: suspend (response: T) -> R): R

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

Link copied to clipboard
suspend fun execute(): HttpResponse

Executes this statement and download the response. After the method execution finishes, the client downloads the response body in memory and release the connection.

suspend fun <T> execute(block: suspend (response: HttpResponse) -> T): T

Executes this statement and calls the block with the streaming response.

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

Extensions

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 (response: T) -> R): R

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