Skip to content

Commit dfd6e4a

Browse files
committed
fix(core/protocols): awsQuery error shape consistency and ec2 middleware content length
1 parent 49a7bed commit dfd6e4a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/middleware-sdk-ec2/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { SignatureV4 } from "@smithy/signature-v4";
55
import { extendedEncodeURIComponent } from "@smithy/smithy-client";
66
import type {
77
AwsCredentialIdentity,
8+
BodyLengthCalculator,
89
ChecksumConstructor,
910
Endpoint,
1011
HandlerExecutionContext,
@@ -29,6 +30,7 @@ interface PreviouslyResolved {
2930
sha256: ChecksumConstructor | HashConstructor;
3031
signingEscapePath: boolean;
3132
regionInfoProvider?: RegionInfoProvider;
33+
bodyLengthChecker: BodyLengthCalculator;
3234
}
3335

3436
const version = "2016-11-15";
@@ -123,6 +125,9 @@ export function copySnapshotPresignedUrlMiddleware(options: PreviouslyResolved):
123125
if (!(request.body ?? "").includes("PresignedUrl=")) {
124126
request.body += `&PresignedUrl=${extendedEncodeURIComponent(args.input.PresignedUrl)}`;
125127
}
128+
if (typeof options.bodyLengthChecker === "function") {
129+
request.headers["content-length"] = String(options.bodyLengthChecker(request.body));
130+
}
126131
}
127132
}
128133

0 commit comments

Comments
 (0)