Skip to content

Commit f0bb068

Browse files
author
Chase Coalwell
authored
Fix query list encoding (#134)
1 parent 9203a7e commit f0bb068

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,13 @@ private boolean writeRequestQueryString(
314314
Shape target = model.expectShape(binding.getMember().getTarget());
315315
String queryValue = getInputValue(context, binding.getLocation(), "input." + memberName,
316316
binding.getMember(), target);
317-
writer.write("query[__extendedEncodeURIComponent($S)] = __extendedEncodeURIComponent($L);",
318-
binding.getLocationName(), queryValue);
317+
if (target instanceof CollectionShape) {
318+
writer.write("query[__extendedEncodeURIComponent($S)] = $L.map(entry => "
319+
+ "__extendedEncodeURIComponent(entry));", binding.getLocationName(), queryValue);
320+
} else {
321+
writer.write("query[__extendedEncodeURIComponent($S)] = __extendedEncodeURIComponent($L);",
322+
binding.getLocationName(), queryValue);
323+
}
319324
});
320325
}
321326
}

0 commit comments

Comments
 (0)