Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant