diff --git a/lib/aws/AwsSigv4Signer.js b/lib/aws/AwsSigv4Signer.js index 9a7455007..d46ba351d 100644 --- a/lib/aws/AwsSigv4Signer.js +++ b/lib/aws/AwsSigv4Signer.js @@ -13,6 +13,7 @@ const Connection = require('../Connection'); const Transport = require('../Transport'); const aws4 = require('aws4'); const AwsSigv4SignerError = require('./errors'); +const crypto = require('crypto'); const getAwsSDKCredentialsProvider = async () => { // First try V3 @@ -77,13 +78,12 @@ function AwsSigv4Signer(opts = {}) { request.region = opts.region; request.headers = request.headers || {}; request.headers['host'] = request.hostname; - if (opts.service === 'aoss') { - const body = delete request.body; - const signed = aws4.sign(request, credentialsState.credentials); - signed.body = body; - return signed; - } - return aws4.sign(request, credentialsState.credentials); + const signed = aws4.sign(request, credentialsState.credentials); + signed.headers['x-amz-content-sha256'] = crypto + .createHash('sha256') + .update(request.body || '', 'utf8') + .digest('hex'); + return signed; } class AwsSigv4SignerConnection extends Connection {