Skip to content

Commit 7eeaf1a

Browse files
committed
Use orginal AsyncRequestBody for each retry
1 parent 8159406 commit 7eeaf1a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/http/pipeline/stages/AsyncRetryableStage.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.slf4j.LoggerFactory;
2525
import software.amazon.awssdk.annotations.SdkInternalApi;
2626
import software.amazon.awssdk.core.SdkStandardLogger;
27+
import software.amazon.awssdk.core.async.AsyncRequestBody;
2728
import software.amazon.awssdk.core.client.config.SdkClientOption;
2829
import software.amazon.awssdk.core.exception.NonRetryableException;
2930
import software.amazon.awssdk.core.exception.SdkException;
@@ -81,12 +82,14 @@ private class RetryExecutor {
8182
private final SdkHttpFullRequest request;
8283
private final RequestExecutionContext context;
8384
private final RetryHandler retryHandler;
85+
private final AsyncRequestBody originalRequestBody;
8486

8587
private int requestCount = 0;
8688

8789
private RetryExecutor(SdkHttpFullRequest request, RequestExecutionContext context) {
8890
this.request = request;
8991
this.context = context;
92+
this.originalRequestBody = context.requestProvider();
9093
this.retryHandler = new RetryHandler(retryPolicy, retryCapacity);
9194
}
9295

@@ -189,6 +192,8 @@ private CompletableFuture<Response<OutputT>> doExecute() throws Exception {
189192
SdkStandardLogger.REQUEST_LOGGER.debug(() -> (retryHandler.isRetry() ? "Retrying " : "Sending ") +
190193
"Request: " + request);
191194

195+
// Before each attempt, Modify the context to use original request body provider
196+
context.requestProvider(originalRequestBody);
192197
return requestPipeline.execute(retryHandler.addRetryInfoHeader(request, requestCount), context);
193198
}
194199
}

0 commit comments

Comments
 (0)