Skip to content

Commit 626fed6

Browse files
Always wrap event stream response bodies
1 parent 9f2f144 commit 626fed6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codegen/smithy-python-codegen/src/main/java/software/amazon/smithy/python/codegen/integration/RestJsonProtocolGenerator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ public void wrapEventStream(GenerationContext context, PythonWriter writer) {
406406
writer.addImports("aws_event_stream.aio", Set.of(
407407
"AWSDuplexEventStream", "AWSInputEventStream", "AWSOutputEventStream"));
408408
writer.addImport("smithy_json", "JSONCodec");
409+
writer.addImport("smithy_core.aio.types", "AsyncBytesReader");
409410
writer.addImport("smithy_core.types", "TimestampFormat");
410411
writer.addStdlibImport("typing", "Any");
411412

@@ -417,7 +418,7 @@ public void wrapEventStream(GenerationContext context, PythonWriter writer) {
417418
payload_codec=codec,
418419
initial_response=operation_output,
419420
async_writer=execution_context.transport_request.body, # type: ignore
420-
async_reader=execution_context.transport_response.body, # type: ignore
421+
async_reader=AsyncBytesReader(execution_context.transport_response.body), # type: ignore
421422
deserializer=event_deserializer, # type: ignore
422423
)
423424
else:
@@ -430,7 +431,7 @@ public void wrapEventStream(GenerationContext context, PythonWriter writer) {
430431
return AWSOutputEventStream[Any, Any](
431432
payload_codec=codec,
432433
initial_response=operation_output,
433-
async_reader=execution_context.transport_response.body, # type: ignore
434+
async_reader=AsyncBytesReader(execution_context.transport_response.body), # type: ignore
434435
deserializer=event_deserializer, # type: ignore
435436
)
436437
""");

0 commit comments

Comments
 (0)