Skip to content

Commit 35572ee

Browse files
authored
Remove redundant return from collectBodyString and isSerializableHeaderValue (#176)
1 parent 01f4b16 commit 35572ee

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,8 @@ static void generateCollectBodyString(GenerationContext context) {
226226

227227
writer.addImport("SerdeContext", "__SerdeContext", "@aws-sdk/types");
228228
writer.write("// Encode Uint8Array data into string with utf-8.");
229-
writer.openBlock("const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> => {",
230-
"};", () -> {
231-
writer.write("return collectBody(streamBody, context).then(body => context.utf8Encoder(body));");
232-
});
233-
229+
writer.write("const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> => " +
230+
"collectBody(streamBody, context).then(body => context.utf8Encoder(body))");
234231
writer.write("");
235232
}
236233

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
function isSerializableHeaderValue(value: any): boolean {
2-
return value !== undefined
3-
&& value !== ""
4-
&& (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0)
5-
&& (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
6-
}
1+
const isSerializableHeaderValue = (value: any): boolean =>
2+
value !== undefined &&
3+
value !== "" &&
4+
(!Object.getOwnPropertyNames(value).includes("length") ||
5+
value.length != 0) &&
6+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);

0 commit comments

Comments
 (0)