Retrofit: Inappropriate blocking method call

Created on 22 Nov 2019  路  1Comment  路  Source: square/retrofit

I can use the coroutines of Kotlin with Retrofit. But I get a warning in Android Studio when I try to deserialize the error body.

This is the warning: "Warning:(38, 51) Inappropriate blocking method call"

This is the code:

override suspend fun checkCredentials(email: String, password: String): AuthorizedUser { val response = authService.signIn(User(email, password)).awaitResponse() if (response.isSuccessful) { ...... } else { val errorBody = response.errorBody()?.string() //Warning .... } }

Most helpful comment

The error body is always buffered so this is a false positive. I suspect the inspection isn't smart enough to understand that, it seems to false positive quite a lot

>All comments

The error body is always buffered so this is a false positive. I suspect the inspection isn't smart enough to understand that, it seems to false positive quite a lot

Was this page helpful?
0 / 5 - 0 ratings