Skip to content

Commit 89fedbc

Browse files
committed
test: indifference to comma separated header spacing
1 parent 35676e0 commit 89fedbc

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/HttpProtocolTestGenerator.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import software.amazon.smithy.utils.IoUtils;
7272
import software.amazon.smithy.utils.MapUtils;
7373
import software.amazon.smithy.utils.Pair;
74+
import software.amazon.smithy.utils.SetUtils;
7475
import software.amazon.smithy.utils.SmithyInternalApi;
7576

7677
/**
@@ -91,6 +92,9 @@ public final class HttpProtocolTestGenerator implements Runnable {
9192

9293
private static final Logger LOGGER = Logger.getLogger(HttpProtocolTestGenerator.class.getName());
9394
private static final String TEST_CASE_FILE_TEMPLATE = "test/functional/%s.spec.ts";
95+
private static final Set<String> IGNORE_COMMA_SPACING = SetUtils.of(
96+
"content-encoding"
97+
);
9498

9599
private final TypeScriptSettings settings;
96100
private final Model model;
@@ -517,7 +521,17 @@ private void writeHttpHeaderAssertions(HttpMessageTestCase testCase) {
517521
testCase.getHeaders().forEach((header, value) -> {
518522
header = header.toLowerCase();
519523
writer.write("expect(r.headers[$S]).toBeDefined();", header);
520-
writer.write("expect(r.headers[$S]).toBe($S);", header, value);
524+
if (IGNORE_COMMA_SPACING.contains(header) && value.contains(",")) {
525+
writer.write("""
526+
expect(
527+
r.headers[$S].replaceAll(", ", ",")
528+
).toBe(
529+
$S.replaceAll(", ", ",")
530+
);
531+
""", header, value);
532+
} else {
533+
writer.write("expect(r.headers[$S]).toBe($S);", header, value);
534+
}
521535
});
522536
writer.write("");
523537
}

0 commit comments

Comments
 (0)