Skip to content

Commit dfb0664

Browse files
authored
chore: use lowercase headers in middleware-compression (#1416)
1 parent 35676e0 commit dfb0664

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.changeset/eighty-queens-yawn.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+
use lowercase headers

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe(compressionMiddleware.name, () => {
9595
body: mockCompressedStream,
9696
headers: {
9797
...mockArgs.request.headers,
98-
"Content-Encoding": "gzip",
98+
"content-encoding": "gzip",
9999
},
100100
},
101101
});
@@ -130,7 +130,7 @@ describe(compressionMiddleware.name, () => {
130130
body: mockCompressedBody,
131131
headers: {
132132
...mockArgs.request.headers,
133-
"Content-Encoding": "gzip",
133+
"content-encoding": "gzip",
134134
},
135135
},
136136
});
@@ -148,7 +148,7 @@ describe(compressionMiddleware.name, () => {
148148
request: {
149149
...mockArgs.request,
150150
headers: {
151-
"Content-Encoding": mockExistingContentEncoding,
151+
"content-encoding": mockExistingContentEncoding,
152152
},
153153
},
154154
} as any);
@@ -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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export const compressionMiddleware =
7979

8080
if (isRequestCompressed) {
8181
// Either append to the header if it already exists, else set it
82-
if (headers["Content-Encoding"]) {
82+
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 {
88-
updatedHeaders = { ...headers, "Content-Encoding": algorithm };
88+
updatedHeaders = { ...headers, "content-encoding": algorithm };
8989
}
9090

9191
// We've matched on one supported algorithm in the

0 commit comments

Comments
 (0)