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

Improve support for Unit as the return type #3702

Merged
merged 1 commit into from
Mar 30, 2022

Conversation

ansman
Copy link
Contributor

@ansman ansman commented Feb 25, 2022

Specifically this change fixes two cases:

  • Using Unit for with suspending functions for responses without a body.
  • Using Unit for HEAD requests.

This fixes #2888 but in a more compatible way. Closes #3648. Closes #3470.

@@ -83,6 +84,12 @@ suspend fun <T : Any> Call<T?>.await(): T? {
}
}

@JvmName("awaitUnit")
suspend fun Call<Unit>.await() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer this could be made internal but the type resolution seems to work fine so it seems like a nice addition.

@ansman
Copy link
Contributor Author

ansman commented Feb 25, 2022

I just noticed that #3648 fixes the head stuff so I could revert that part.

@JakeWharton
Copy link
Collaborator

This looks good. I'll review in depth next week. Retrofit is high up on my backlog of things to work on.

Specifically this change fixes two cases:
- Using Unit for with suspending functions for responses without a body.
- Using Unit for HEAD requests.
@JakeWharton JakeWharton merged commit 1490e6b into square:master Mar 30, 2022
@ansman ansman deleted the improve-unit-support branch March 30, 2022 19:00
@Goooler Goooler mentioned this pull request Dec 19, 2023
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

Successfully merging this pull request may close these issues.

2 participants