Skip to content

Commit

Permalink
Merge pull request #36351 from geoand/#36257
Browse files Browse the repository at this point in the history
Properly handle invalid response body errors in Reactive REST Client
  • Loading branch information
geoand authored Oct 9, 2023
2 parents 6be99a4 + 7de4dcc commit 39113e3
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 39113e3

Please sign in to comment.