Skip to content

Commit dc233a9

Browse files
authored
add default body value before collecting body stream (#171)
1 parent 840ba11 commit dc233a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static void generateCollectBody(GenerationContext context) {
204204

205205
writer.addImport("SerdeContext", "__SerdeContext", "@aws-sdk/types");
206206
writer.write("// Collect low-level response body stream to Uint8Array.");
207-
writer.openBlock("const collectBody = (streamBody: any, context: __SerdeContext): Promise<Uint8Array> => {",
208-
"};", () -> {
207+
writer.openBlock("const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): "
208+
+ "Promise<Uint8Array> => {", "};", () -> {
209209
writer.openBlock("if (streamBody instanceof Uint8Array) {", "}", () -> {
210210
writer.write("return Promise.resolve(streamBody);");
211211
});

0 commit comments

Comments
 (0)