From b051044f8c8e65d21e5122cb3a4290e23ead2bba Mon Sep 17 00:00:00 2001 From: Rohan Date: Mon, 11 Jul 2022 10:41:05 +0530 Subject: [PATCH] fix: set token header if available Closes #24 --- simples3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simples3.go b/simples3.go index 77ac5ea..3d30d2d 100644 --- a/simples3.go +++ b/simples3.go @@ -311,6 +311,10 @@ func (s3 *S3) signRequest(req *http.Request) error { req.Header.Set("Date", t.Format(amzDateISO8601TimeFormat)) req.Header.Set("X-Amz-Date", t.Format(amzDateISO8601TimeFormat)) + if s3.Token != "" { + req.Header.Set("X-Amz-Security-Token", s3.Token) + } + // The x-amz-content-sha256 header is required for all AWS // Signature Version 4 requests. It provides a hash of the // request payload. If there is no payload, you must provide