Today, RestProxy takes care of disposing response if there's no need to process body, i.e. there's Response<Foo, Void>.
Related code:
|
return response.getSourceResponse().getBody().ignoreElements() |
and
|
public static boolean shouldEagerlyReadResponse(Type returnType) { |
We can (probably) simplify this logic a bit by introducing enum to cover the requested response type and also release a connection a little bit faster.
We can consider an enum ResponseBodyReadStrategy { EAGER, STREAMED, NO_RESPONSE_BODY } and take care of that handling at http client layer instead in rest proxy.
Something like:

Today, RestProxy takes care of disposing response if there's no need to process body, i.e. there's
Response<Foo, Void>.Related code:
azure-sdk-for-java/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/RestProxy.java
Line 475 in 627f107
and
azure-sdk-for-java/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java
Line 393 in 627f107
We can (probably) simplify this logic a bit by introducing enum to cover the requested response type and also release a connection a little bit faster.

We can consider an
enum ResponseBodyReadStrategy { EAGER, STREAMED, NO_RESPONSE_BODY }and take care of that handling at http client layer instead in rest proxy.Something like: