Skip to content

Commit 50dd0a4

Browse files
committed
If request has a streamed body then don't retry
Retying a streamed request might mean the initial part of the stream is missing.
1 parent 9d44bcd commit 50dd0a4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/SotoCore/Middleware/Middleware/RetryMiddleware.swift

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ struct RetryMiddleware: AWSMiddlewareProtocol {
2929
try Task.checkCancellation()
3030
return try await next(request, context)
3131
} catch {
32+
// If request is streaming then do not allow a retry
33+
if request.body.isStreaming {
34+
throw error
35+
}
3236
// If I get a retry wait time for this error then attempt to retry request
3337
if case .retry(let retryTime) = self.retryPolicy.getRetryWaitTime(error: error, attempt: attempt) {
3438
context.logger.trace("Retrying request", metadata: [

0 commit comments

Comments
 (0)