opened 06:29PM - 17 Jan 25 UTC
closed 08:12PM - 17 Jan 25 UTC
guidance
### Checkboxes for prior research
- [x] I've gone through [Developer Guide](htt…ps://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide) and [API reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest)
- [x] I've checked [AWS Forums](https://forums.aws.amazon.com) and [StackOverflow](https://stackoverflow.com/questions/tagged/aws-sdk-js).
- [x] I've searched for [previous similar issues](https://github.com/aws/aws-sdk-js-v3/issues) and didn't find any solution.
### Describe the bug
s3.deleteObjects sends CRC32 checksum even if `requestChecksumCalculation` is set to `WHEN_REQUIRED`
### Regression Issue
- [x] Select this option if this issue appears to be a regression.
### SDK version number
@aws-sdk/client-s3@2.729.0
### Which JavaScript Runtime is this issue in?
Node.js
### Details of the browser/Node.js/ReactNative version
All
### Reproduction Steps
```js
import { S3 } from "@aws-sdk/client-s3";
import { NodeHttpHandler } from "@smithy/node-http-handler";
class CustomHandler extends NodeHttpHandler {
constructor() {
super();
}
printChecksumHeaders(prefix, headers) {
for (const [header, value] of Object.entries(headers)) {
if (
header === "content-md5" ||
header.startsWith("x-amz-checksum-") ||
header.startsWith("x-amz-sdk-checksum-")
) {
console.log(`${prefix}['${header}']: '${value}'`);
}
}
}
async handle(request, options) {
this.printChecksumHeaders("request", request.headers);
const response = await super.handle(request, options);
this.printChecksumHeaders("response", response.response.headers);
return response;
}
}
const client = new S3({
requestHandler: new CustomHandler(),
requestChecksumCalculation: "WHEN_REQUIRED",
});
const Bucket = "test-flexible-checksums-v2"; // Update to your test bucket name.
const prepareClient = new S3();
// Populate an object in the bucket, as deleteObjects requires at least one.
await prepareClient.putObject({ Bucket, Key: "helloworld.txt", Body: "helloworld" });
// Get list of objects to delete.
const response = await prepareClient.listObjectsV2({ Bucket });
const Objects = response.Contents.map(({ Key }) => ({ Key }));
await client.deleteObjects({ Bucket, Delete: { Objects } });
```
### Observed Behavior
The CRC32 checksum is sent even if `requestChecksumCalculation` is set to `WHEN_REQUIRED`
```console
$ node test.mjs
request['x-amz-sdk-checksum-algorithm']: 'CRC32'
request['x-amz-checksum-crc32']: 'uDrkBQ=='
```
### Expected Behavior
When `requestChecksumCalculation` is set to `WHEN_REQUIRED`, should it send `md5` like it was done in `<=v3.729.0`?
Example output in `v3.726.0`
```console
$ node test.mjs
request['content-md5']: 'rl/UEqX25ygZIHP8TWK6/g=='
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_