blockingGet
fun <T> KtorDsl.blockingGet(url: String, httpClient: HttpClient? = null, expectSuccess: Boolean = false, setUp: HttpRequestBuilder.() -> Unit = {}, block: suspend (HttpResponse) -> T): T
Performs a blocking HTTP GET request.
Blocks the current thread until the response is received and processed by block. When httpClient is null, a new client is created for the request and closed afterward; a provided client is used and left open. JVM only (uses runBlocking); declared as an extension on KtorDsl so KtorDsl.blockingGet(...) call sites keep compiling.
Return
the result of block
Parameters
url
the URL to send the GET request to
httpClient
an optional client to reuse; if null, a new client is created and closed
expectSuccess
if true, non-2xx responses throw (only applies to a newly created client)
setUp
an optional configuration block for the HttpRequestBuilder
block
a suspending block that receives the HttpResponse
Type Parameters
T
the return type of the block