Skip to content

Commit

Permalink
fix(middleware-flexible-checksums): append content-encoding aws-chunk…
Browse files Browse the repository at this point in the history
…ed instead of replacing (#4368)
  • Loading branch information
kuhe authored Jan 26, 2023
1 parent 30b45af commit dac8a92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe(flexibleChecksumsMiddleware.name, () => {
const mockMiddlewareConfig = { input: mockInput, requestChecksumRequired: false };

const mockBody = { body: "mockRequestBody" };
const mockHeaders = { "content-length": 100 };
const mockHeaders = { "content-length": 100, "content-encoding": "gzip" };
const mockRequest = { body: mockBody, headers: mockHeaders };
const mockArgs = { request: mockRequest } as BuildHandlerArguments<any>;
const mockResult = { response: { body: "mockResponsebody" } };
Expand Down Expand Up @@ -146,7 +146,7 @@ describe(flexibleChecksumsMiddleware.name, () => {
headers: {
...mockHeaders,
"content-length": undefined,
"content-encoding": "aws-chunked",
"content-encoding": "gzip,aws-chunked",
"transfer-encoding": "chunked",
"x-amz-decoded-content-length": mockHeaders["content-length"],
"x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const flexibleChecksumsMiddleware =
});
updatedHeaders = {
...headers,
"content-encoding": "aws-chunked",
"content-encoding": headers["content-encoding"]
? `${headers["content-encoding"]},aws-chunked`
: "aws-chunked",
"transfer-encoding": "chunked",
"x-amz-decoded-content-length": headers["content-length"],
"x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER",
Expand Down

0 comments on commit dac8a92

Please sign in to comment.