From de8258595882f5038c32141bb431e6fbf9b159be Mon Sep 17 00:00:00 2001 From: Rohan Date: Mon, 21 Feb 2022 10:14:17 +0530 Subject: [PATCH] feat: add support for DigitalOcean This commit adds a x-amz-date header which is an undocumented requirement of DO API requests. --- simples3.go | 1 + simples3_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/simples3.go b/simples3.go index 479f242..77ac5ea 100644 --- a/simples3.go +++ b/simples3.go @@ -309,6 +309,7 @@ func (s3 *S3) signRequest(req *http.Request) error { } } req.Header.Set("Date", t.Format(amzDateISO8601TimeFormat)) + req.Header.Set("X-Amz-Date", t.Format(amzDateISO8601TimeFormat)) // The x-amz-content-sha256 header is required for all AWS // Signature Version 4 requests. It provides a hash of the diff --git a/simples3_test.go b/simples3_test.go index 15e73d8..70d34f8 100644 --- a/simples3_test.go +++ b/simples3_test.go @@ -155,7 +155,7 @@ func TestS3_FileUploadPostAndPut(t *testing.T) { }) if (err != nil) != tt.wantErr { - t.Errorf("S3.FileUpload() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("S3.FileDetails() error = %v, wantErr %v", err, tt.wantErr) } if len(dResp.AmzMeta) != len(tt.args.u.CustomMetadata) {