Skip to content

Commit

Permalink
Properly handle invalid response body errors in Reactive REST Client
Browse files Browse the repository at this point in the history
Fixes: quarkusio#36257
(cherry picked from commit 7de4dcc)
  • Loading branch information
geoand authored and aloubyansky committed Oct 25, 2023
1 parent ac28e99 commit c2b33a4
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,22 +320,27 @@ public void handle(AsyncResult<Void> flushed) {
new VertxClientInputStream(clientResponse, 100000, requestContext));
requestContext.resume();
} else {
clientResponse.bodyHandler(new Handler<>() {
clientResponse.body(new Handler<>() {
@Override
public void handle(Buffer buffer) {
if (loggingScope != LoggingScope.NONE) {
clientLogger.logResponse(clientResponse, false);
}
try {
if (buffer.length() > 0) {
requestContext.setResponseEntityStream(
new ByteArrayInputStream(buffer.getBytes()));
} else {
requestContext.setResponseEntityStream(null);
public void handle(AsyncResult<Buffer> ar) {
if (ar.succeeded()) {
if (loggingScope != LoggingScope.NONE) {
clientLogger.logResponse(clientResponse, false);
}
Buffer buffer = ar.result();
try {
if (buffer.length() > 0) {
requestContext.setResponseEntityStream(
new ByteArrayInputStream(buffer.getBytes()));
} else {
requestContext.setResponseEntityStream(null);
}
requestContext.resume();
} catch (Throwable t) {
requestContext.resume(t);
}
requestContext.resume();
} catch (Throwable t) {
requestContext.resume(t);
} else {
requestContext.resume(ar.cause());
}
}
});
Expand Down

0 comments on commit c2b33a4

Please sign in to comment.