Skip to content
Merged
Changes from all 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 @@ -2452,8 +2452,10 @@ private HttpBinding readPayload(
// There can only be one payload binding.
Shape target = context.getModel().expectShape(binding.getMember().getTarget());

boolean isStreaming = target.hasTrait(StreamingTrait.class);

// Handle streaming shapes differently.
if (target.hasTrait(StreamingTrait.class)) {
if (isStreaming) {
writer.write("const data: any = output.body;");
// If payload is streaming blob, return low-level stream with the stream utility functions mixin.
if (isClientSdk && target instanceof BlobShape) {
Expand All @@ -2479,7 +2481,7 @@ private HttpBinding readPayload(
target.getType()));
}

if (target instanceof UnionShape) {
if (!isStreaming && target instanceof UnionShape) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to match the condition on line 2472

} else if (target instanceof UnionShape) {

which isn't only target instanceof UnionShape but also that the prior if branch was not entered.

writer.openBlock(
"if (Object.keys(data ?? {}).length) {",
"}",
Expand Down
Loading