Skip to content

Commit 8fa791c

Browse files
committed
fix: replace UTC time with local time (MST) in request date header to ensure compatibility with server expectations and avoid time skew errors
1 parent 4c057a0 commit 8fa791c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

zstack-sdk-go/pkg/client/zstack_http_client.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,7 @@ func (cli *ZSHttpClient) getAccessKeyHeader(url, method string) (http.Header, er
551551
//loc, _ := time.LoadLocation("Asia/Shanghai")
552552
//date := time.Now().In(loc).Format("Mon, 02 Jan 2006 15:04:05 MST")
553553

554-
loc, _ := time.LoadLocation("UTC")
555-
date := time.Now().In(loc).Format("Mon, 02 Jan 2006 15:04:05 UTC")
554+
date := time.Now().Local().Format("Mon, 02 Jan 2006 15:04:05 MST")
556555

557556
contextPath := fmt.Sprintf("/%s", cli.contextPath)
558557
uri := url[strings.Index(url, contextPath)+len(contextPath):]

0 commit comments

Comments
 (0)