Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Retrofit responses with a null body #5

Open
MovementSpeed opened this issue Oct 21, 2022 · 0 comments
Open

Retrofit responses with a null body #5

MovementSpeed opened this issue Oct 21, 2022 · 0 comments

Comments

@MovementSpeed
Copy link

Currently, when using Esito's Result with a network request that returns a null body (example: fun foo(...): Result<Unit, Throwable>), EsitoBodyThrowableCall crashes because it tries to get a non-null body:

private fun <T> Response<T>.toEsitoResult(): Result<T, Throwable> {
        return if (isSuccessful) {
            Result.success(body()!!)
        } else {
            Result.failure(HttpException(this))
        }
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant