Skip to content

Commit

Permalink
fix(middleware-content-length): swallow error if content-length compu…
Browse files Browse the repository at this point in the history
…tation fails (#3429)
  • Loading branch information
trivikr authored Mar 15, 2022
1 parent c2587f3 commit 8c12233
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/middleware-content-length/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
} from "@aws-sdk/types";

const CONTENT_LENGTH_HEADER = "content-length";
const TRANSFER_ENCODING_HEADER = "transfer-encoding";

export function contentLengthMiddleware(bodyLengthChecker: BodyLengthCalculator): BuildMiddleware<any, any> {
return <Output extends MetadataBearer>(next: BuildHandler<any, Output>): BuildHandler<any, Output> =>
Expand All @@ -32,10 +31,8 @@ export function contentLengthMiddleware(bodyLengthChecker: BodyLengthCalculator)
[CONTENT_LENGTH_HEADER]: String(length),
};
} catch (error) {
request.headers = {
...request.headers,
[TRANSFER_ENCODING_HEADER]: "chunked",
};
// ToDo: Add 'transfer-encoding' as chunked only for HTTP/1.1 request
// Refs: https://github.com/aws/aws-sdk-js-v3/pull/3403
}
}
}
Expand Down

0 comments on commit 8c12233

Please sign in to comment.