From 949f40e3c64559ad250b3bd9b4aa5e94ab36f824 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 20 Jun 2023 21:41:49 +0000 Subject: [PATCH] Consume all params and content on extension Rest Request exception (#8096) Signed-off-by: Daniel Widdis (cherry picked from commit 1f6a3bca68149eb263a1287f3aeed767226813ad) Signed-off-by: github-actions[bot] --- .../opensearch/rest/extensions/RestSendToExtensionAction.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/main/java/org/opensearch/rest/extensions/RestSendToExtensionAction.java b/server/src/main/java/org/opensearch/rest/extensions/RestSendToExtensionAction.java index 8c4e3f4b42412..51ff74b1869a0 100644 --- a/server/src/main/java/org/opensearch/rest/extensions/RestSendToExtensionAction.java +++ b/server/src/main/java/org/opensearch/rest/extensions/RestSendToExtensionAction.java @@ -219,6 +219,10 @@ public void handleResponse(RestExecuteOnExtensionResponse response) { @Override public void handleException(TransportException exp) { logger.debug("REST request failed", exp); + // On failure the original request params and content aren't consumed + // which gives misleading error messages, so we just consume them here + request.params().keySet().stream().forEach(p -> request.param(p)); + request.content(); inProgressFuture.completeExceptionally(exp); }