diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java index 084e9a697d1..9154108edcd 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java @@ -71,6 +71,7 @@ import software.amazon.smithy.utils.IoUtils; import software.amazon.smithy.utils.MapUtils; import software.amazon.smithy.utils.Pair; +import software.amazon.smithy.utils.SetUtils; import software.amazon.smithy.utils.SmithyInternalApi; /** @@ -91,6 +92,9 @@ public final class HttpProtocolTestGenerator implements Runnable { private static final Logger LOGGER = Logger.getLogger(HttpProtocolTestGenerator.class.getName()); private static final String TEST_CASE_FILE_TEMPLATE = "test/functional/%s.spec.ts"; + private static final Set IGNORE_COMMA_SPACING = SetUtils.of( + "content-encoding" + ); private final TypeScriptSettings settings; private final Model model; @@ -517,7 +521,17 @@ private void writeHttpHeaderAssertions(HttpMessageTestCase testCase) { testCase.getHeaders().forEach((header, value) -> { header = header.toLowerCase(); writer.write("expect(r.headers[$S]).toBeDefined();", header); - writer.write("expect(r.headers[$S]).toBe($S);", header, value); + if (IGNORE_COMMA_SPACING.contains(header) && value.contains(",")) { + writer.write(""" + expect( + r.headers[$S].replaceAll(", ", ",") + ).toBe( + $S.replaceAll(", ", ",") + ); + """, header, value); + } else { + writer.write("expect(r.headers[$S]).toBe($S);", header, value); + } }); writer.write(""); }