hikkidev
HttpCallValidator
val client = HttpClient(OkHttp) { expectSuccess = false install(HttpCallValidator) { validateResponse { response -> throw RuntimeException("Response not valid") } } } @Throws(RuntimeException::class) suspend fun myBestRequest(): MyResponseObj = client.get {...}
try { val response = myBestRequest() Result.success(response) } catch (cause: Throwable) { Result.failure(cause) }
cy
e5l
A modern programming language that makes developers happier.