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
  • Loading branch information
geoand committed Oct 9, 2023
1 parent 0095d5f commit 7de4dcc
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,22 +322,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 7de4dcc

Please sign in to comment.