ok2c commented on code in PR #828:
URL: 
https://github.com/apache/httpcomponents-client/pull/828#discussion_r3236886917


##########
httpclient5-jakarta-rest-client/src/main/java/org/apache/hc/client5/http/rest/RestInvocationHandler.java:
##########
@@ -189,51 +224,105 @@ private Object executeRequest(final MethodInvoker 
invoker,
             entityProducer = null;
         }
 
-        final Class<?> rawType = rm.getMethod().getReturnType();
         final BasicRequestProducer requestProducer =
                 new BasicRequestProducer(request, entityProducer);
+        final CompletableFuture<Object> future = dispatchAsync(invoker, 
requestProducer);
+        if (invoker.async) {
+            return future;
+        }
+        return awaitSync(future);
+    }
+
+    private CompletableFuture<Object> dispatchAsync(final MethodInvoker 
invoker,
+                                                    final BasicRequestProducer 
requestProducer) {
+        final Class<?> rawType = invoker.responseType;
+
+        if (rawType == void.class || rawType == Void.class) {
+            return submit(requestProducer, new BasicResponseConsumer<>(new 
DiscardingEntityConsumer<>()))
+                    .thenApply(result -> {
+                        checkStatus(result.getHead(), null);
+                        return null;
+                    });
+        }
+        if (rawType == Response.class) {
+            return submit(requestProducer, new BasicResponseConsumer<>(new 
BasicAsyncEntityConsumer()))

Review Comment:
   @arturobernalg See if one could use`JsonNodeEntityFallbackConsumer` here or 
a similar custom response consumer. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to