https://kotlinlang.org logo
Title
g

GarouDan

05/23/2018, 1:04 PM
Hi guys. I’m using the library Fuel for Kotlin: https://github.com/kittinunf/Fuel It’s very nice. But I was wondering, instead of doing some complex code like we usually did in JavaScript before, Kotlin (or can we find a way) to use some kind of `await`operator? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await For example:
val (request, response, result) = await "<http://httpbin.org/get>".httpGet().responseString()
instead of
val (request, response, result) = "<http://httpbin.org/get>".httpGet().responseString() // without await and thread blocking
a

araqnid

05/23/2018, 1:10 PM
from a glance at the README, it has an async mode, so could definitely be wrapped up to return a Deferred and be awaited by a coroutine (= suspending function)
given the README also mentions a fuel-coroutines library, it seems likely the author knows/has already done this
g

GarouDan

05/23/2018, 1:30 PM
Hum, thanks @araqnid. I will take a look. Thanks a lot.