Skip to content

Commit 8d07998

Browse files
committed
test(middleware-flexible-checksums): context command update
1 parent 6c44d87 commit 8d07998

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/middleware-flexible-checksums/src/middleware-md5-fallback.e2e.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ describe("S3 MD5 Fallback for DeleteObjects", () => {
1313
let s3: S3;
1414
let Bucket: string;
1515
const testFiles = ["md5-test-1.txt", "md5-test-2.txt"];
16-
const md5Hash = createHash("md5");
1716

1817
beforeAll(async () => {
1918
s3 = new S3({ region: "us-west-2" });
@@ -76,7 +75,7 @@ describe("S3 MD5 Fallback for DeleteObjects", () => {
7675
md5S3Client.middlewareStack.add(
7776
(next, context) => async (args) => {
7877
// Check if this is a DeleteObjects command
79-
const isDeleteObjects = context.commandName === "DeleteObjects";
78+
const isDeleteObjects = context.commandName === "DeleteObjectsCommand";
8079

8180
if (!isDeleteObjects) {
8281
return next(args);
@@ -99,7 +98,8 @@ describe("S3 MD5 Fallback for DeleteObjects", () => {
9998
// Add MD5
10099
if (args.request.body) {
101100
const bodyContent = Buffer.from(args.request.body);
102-
headers["Content-MD5"] = md5Hash.update(bodyContent).digest("base64");
101+
const md5Hash = createHash("md5").update(bodyContent).digest("base64");
102+
headers["Content-MD5"] = md5Hash;
103103
md5Added = true;
104104
}
105105

0 commit comments

Comments
 (0)