Skip to content

Commit 8a624ff

Browse files
author
ke.like
committed
Address comments
1 parent d6ed04f commit 8a624ff

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ type Client struct {
101101
HTTPClient *http.Client
102102
Region string
103103
AuthVersion AuthVersionType // v1 or v4 signature,default is v1
104-
accessKeyLock sync.RWMutex
104+
105+
accessKeyLock sync.RWMutex
105106
}
106107

107108
func convert(c *Client, projName string) *LogProject {

signature.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (s *SignerV1) Sign(method, uri string, headers map[string]string, body []by
134134
return err
135135
}
136136
digest := base64.StdEncoding.EncodeToString(mac.Sum(nil))
137-
auth := fmt.Sprintf("SLS %v:%v", s.accessKeyID, digest)
137+
auth := fmt.Sprintf("SLS %s:%s", s.accessKeyID, digest)
138138
headers[HTTPHeaderAuthorization] = auth
139139
return nil
140140
}

signature_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ type SignerV1Suite struct {
1414
AccessKeyID string
1515
AccessKeySecret string
1616
Endpoint string
17-
signer Signer
17+
18+
signer Signer
1819
}
1920

2021
func (s *SignerV1Suite) SetupTest() {

signature_v4.go

-7
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,6 @@ func (s *SignerV4) Sign(method, uri string, headers map[string]string, body []by
6363
return fmt.Errorf("can't find '%s' header", HTTPHeaderLogDate)
6464
}
6565
date := dateTime[:8]
66-
67-
// If content-type value is empty string, server will ignore it.
68-
// So we add a default value here.
69-
if contentType, ok := headers[HTTPHeaderContentType]; ok && len(contentType) == 0 {
70-
headers[HTTPHeaderContentType] = "application/json"
71-
}
72-
7366
// Host should not contain schema here.
7467
if host, ok := headers[HTTPHeaderHost]; ok {
7568
if strings.HasPrefix(host, "http://") {

0 commit comments

Comments
 (0)