Skip to content

Commit 922ba66

Browse files
committed
fix(codegen): only trim xml tag values which contain newline
1 parent e8328f4 commit 922ba66

File tree

1 file changed

+2
-1
lines changed
  • codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen

1 file changed

+2
-1
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ static void generateXmlParseBody(GenerationContext context) {
135135
writer.openBlock("if (encoded.length) {", "}", () -> {
136136
writer.write("const parsedObj = xmlParse(encoded, { attributeNamePrefix: '', "
137137
+ "ignoreAttributes: false, parseNodeValue: false, trimValues: false, "
138-
+ "tagValueProcessor: (val, tagName) => decodeHTML(val) });");
138+
+ "tagValueProcessor: (val) => (val.trim() === '' && val.includes('\\n'))"
139+
+ " ? '': decodeHTML(val) });");
139140
writer.write("const textNodeName = '#text';");
140141
writer.write("const key = Object.keys(parsedObj)[0];");
141142
writer.write("const parsedObjToReturn = parsedObj[key];");

0 commit comments

Comments
 (0)