Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ async def _handle_execution(
except SmithyRetryException:
raise context_with_response.response
await sleep(retry_token.retry_delay)
if (seek := getattr(context_with_transport_request.transport_request.body, "seek")) is not None:
await seek(0)
else:
# Step 8: Invoke record_success
retry_strategy.record_success(token=retry_token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ protected void serializeDocumentBody(
) {
writer.addDependency(SmithyPythonDependency.SMITHY_JSON);
writer.addImport("smithy_json", "JSONCodec");
writer.addImport("smithy_core.aio.types", "AsyncBytesReader");
writer.addImport("smithy_core.aio.types", "SeekableAsyncBytesReader");

writer.pushState();

if (documentBindings.isEmpty()) {
var body = shouldWriteDefaultBody(context, operation) ? "b'{}'" : "b''";
writer.write("""
content_length = 0
body = AsyncBytesReader($L)
body = SeekableAsyncBytesReader($L)
""", body);
} else {
writer.addImport("smithy_core.types", "TimestampFormat");
Expand All @@ -159,7 +159,7 @@ protected void serializeDocumentBody(
content = b'{}'
${/writeDefaultBody}
content_length = len(content)
body = AsyncBytesReader(content)
body = SeekableAsyncBytesReader(content)
""");
}

Expand Down Expand Up @@ -223,13 +223,13 @@ protected void serializePayloadBody(
return;
}

writer.addImport("smithy_core.aio.types", "AsyncBytesReader");
writer.addImport("smithy_core.aio.types", "SeekableAsyncBytesReader");
writer.write("content_length: int = 0");

CodegenUtils.accessStructureMember(context, writer, "input", payloadBinding.getMember(), () -> {
if (target.isBlobShape()) {
writer.write("content_length = len($L)", dataSource);
writer.write("body = AsyncBytesReader($L)", dataSource);
writer.write("body = SeekableAsyncBytesReader($L)", dataSource);
return;
}

Expand All @@ -244,13 +244,13 @@ protected void serializePayloadBody(
""", dataSource);
}
writer.write("content_length = len(content)");
writer.write("body = AsyncBytesReader(content)");
writer.write("body = SeekableAsyncBytesReader(content)");
});
if (target.isStructureShape()) {
writer.write("""
else:
content_length = 2
body = AsyncBytesReader(b'{}')
body = SeekableAsyncBytesReader(b'{}')
""");
}
}
Expand Down
Loading