plastiv
11/12/2018, 4:59 PMtry {
val result = retrofitService.getEndpoint()
// ..
} catch (e: HttpException) {
val errorBody = e.response().errorBody()
withContext(Dispatchers.IO) {
errorBody!!.string() // Will read bytes from network
}
}
Seems to have jumping from okhttp thread pool -> to UI thread -> to IO thread pool 🤔
Ideally I want to stay and parse errorBody on the same thread as connection was open and http200 body is being parsed 😄 But more importantly to correctly propagate the close(stream consumed) and cancel events.