davidasync
02/23/2019, 3:07 PMfun exec () {
GlobalScope.launch {
var counter = 1
val httpClient = HttpClient(Apache)
while (true) {
val clientResponse = httpClient.use {
it.call {
method = <http://HttpMethod.Post|HttpMethod.Post>
url(URL("<https://httpbin.org/post>"))
body = TextContent(bodyVal, contentType = ContentType("application", "json"))
}.response
}
val jsonResponseString = String(clientResponse.readBytes())
println(counter.toString())
counter += 1
}
}
}
suspend fun main () = coroutineScope {
exec()
Thread.sleep(1000000)
}
Is it because I use .use{
?Sergey Bondari
02/23/2019, 6:14 PMbdawg.io
02/23/2019, 11:08 PM