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
awaitBodyOrNull function to handle empty body #26731
Conversation
Created awaitBodyOrNull function to handle empty body suspend inline fun <reified T : Any> WebClient.ResponseSpec.awaitBody() : T does not handle nullable body suspend fun WebClient.ResponseSpec.awaitBodilessEntity() ignores body completely even when the content-length is above zero
@ValentinShakhov Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@ValentinShakhov Thank you for signing the Contributor License Agreement! |
awaitBody() is not something that I wanted to achieve here.
Maybe I am missing or misusing something? |
After a quick first look, it seems a valid proposal. The use case makes sense and we provide already such variant for |
Could you please provide an example of doing that with a ClientResponse? I did try it as well, but it would just hang and wait for the response forever. It could be that I did it wrong, though. p.s.: sorry, I am using different github accounts :) |
For |
Such variant is already provided for ClientResponse but not for WebClient.ResponseSpec. Closes spring-projectsgh-26731
Such variant is already provided for ClientResponse but not for WebClient.ResponseSpec. Closes spring-projectsgh-26731
Such variant is already provided for ClientResponse but not for WebClient.ResponseSpec. Closes spring-projectsgh-26731
Created awaitBodyOrNull function to handle empty body
suspend inline fun <reified T : Any> WebClient.ResponseSpec.awaitBody() : T
does not handle nullable body
suspend fun WebClient.ResponseSpec.awaitBodilessEntity()
ignores body completely even when the content-length is above zero