Skip to content

Commit 4900529

Browse files
committed
add comma spacing for content-encoding header
1 parent 3168eda commit 4900529

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

.changeset/proud-bugs-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@smithy/middleware-compression": patch
3+
---
4+
5+
comma spacing

packages/middleware-compression/src/compressionMiddleware.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe(compressionMiddleware.name, () => {
160160
body: mockCompressedBody,
161161
headers: {
162162
...mockArgs.request.headers,
163-
"content-encoding": [mockExistingContentEncoding, "gzip"].join(","),
163+
"content-encoding": [mockExistingContentEncoding, "gzip"].join(", "),
164164
},
165165
},
166166
});

packages/middleware-compression/src/compressionMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const compressionMiddleware =
8282
if (headers["content-encoding"]) {
8383
updatedHeaders = {
8484
...headers,
85-
"content-encoding": `${headers["content-encoding"]},${algorithm}`,
85+
"content-encoding": `${headers["content-encoding"]}, ${algorithm}`,
8686
};
8787
} else {
8888
updatedHeaders = { ...headers, "content-encoding": algorithm };

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

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ public final class HttpProtocolTestGenerator implements Runnable {
9292

9393
private static final Logger LOGGER = Logger.getLogger(HttpProtocolTestGenerator.class.getName());
9494
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-
);
9895

9996
private final TypeScriptSettings settings;
10097
private final Model model;
@@ -521,17 +518,7 @@ private void writeHttpHeaderAssertions(HttpMessageTestCase testCase) {
521518
testCase.getHeaders().forEach((header, value) -> {
522519
header = header.toLowerCase();
523520
writer.write("expect(r.headers[$S]).toBeDefined();", header);
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-
}
521+
writer.write("expect(r.headers[$S]).toBe($S);", header, value);
535522
});
536523
writer.write("");
537524
}

0 commit comments

Comments
 (0)