ex_aws_s3
ex_aws_s3 copied to clipboard
Add x-amz-checksum headers on put_object
Pull request #244 added support for x-amz-checksum
headers when using other hash algorithms than md5
. This pull request adds the relevant header when using put_object
so new objects will have the appropriate checksum header.
This will work automatically as long as you have something like this in your configuration:
config :ex_aws_s3, :content_hash_algorithm, :sha256 # or :sha or :md5
Additionally, this pull request also updates the accepted headers for the head_object
call so you can get the checksum that was stored in S3 when the object was created. This can be done with the following code:
bucket
|> ExAws.S3.head_object(object, x_amz_checksum_mode: "enabled")
|> ExAws.request!()