@@ -68,7 +68,7 @@ func (s *SignerV4Suite) TestSignV4Case1() {
68
68
auth := s .headers [HTTPHeaderAuthorization ]
69
69
exp := "SLS4-HMAC-SHA256 " +
70
70
"Credential=acsddda21dsd/20220808/cn-hangzhou/sls/aliyun_v4_request," +
71
- "Signature=bcdc405707a79dd61b1407a31613e36cbec25d3bbeecf7101add56aacadbdf1e "
71
+ "Signature=a98f5632e93836e63839cd836a54055f480020a9364ca944e2d34f2eb9bf1bed "
72
72
assert .Equal (s .T (), exp , auth )
73
73
}
74
74
@@ -98,7 +98,7 @@ func (s *SignerV4Suite) TestSignV4Case3() {
98
98
auth := s .headers [HTTPHeaderAuthorization ]
99
99
exp := "SLS4-HMAC-SHA256 " +
100
100
"Credential=acsddda21dsd/20220808/cn-hangzhou/sls/aliyun_v4_request," +
101
- "Signature=b657145686c93047f9c71444e1f2d4bed5ed02f6f24a996ef5067676221de732 "
101
+ "Signature=5a66d8f8051983e0e9d08e0f960ef9252ef971eead5bb5c7acec8617a2eb2701 "
102
102
assert .Equal (s .T (), exp , auth )
103
103
}
104
104
@@ -110,7 +110,7 @@ func (s *SignerV4Suite) TestSignV4Case4() {
110
110
auth := s .headers [HTTPHeaderAuthorization ]
111
111
exp := "SLS4-HMAC-SHA256 " +
112
112
"Credential=acsddda21dsd/20220808/cn-hangzhou/sls/aliyun_v4_request," +
113
- "Signature=5fb4e9302126de99c05643f8f7469eb6c35b7851a04c495dd90840a741451f1b "
113
+ "Signature=d92741852500791d662a8d469ff61627c0559ecd86c3f59b7bf6772b6c62666a "
114
114
assert .Equal (s .T (), exp , auth )
115
115
}
116
116
@@ -123,10 +123,21 @@ func (s *SignerV4Suite) TestSignV4Case5() {
123
123
auth := s .headers [HTTPHeaderAuthorization ]
124
124
exp := "SLS4-HMAC-SHA256 " +
125
125
"Credential=acsddda21dsd/20220808/cn-hangzhou/sls/aliyun_v4_request," +
126
- "Signature=6e3bae51420ade037431836e0b9791a4b750982376fa7e056585af7dcd10eae1 "
126
+ "Signature=2c204068e961a8813a6bcf7ac422f7fa6e9bf9a5da493e0165dfe100854d18ff "
127
127
assert .Equal (s .T (), exp , auth )
128
128
}
129
129
130
+ func (s * SignerV4Suite ) TestSignV4Case6 () {
131
+ mockAKID := "mockAccessKeyID"
132
+ mockAKSec := "mockAccessKeySecret"
133
+ signer := SignerV4 {accessKeyID : mockAKID , accessKeySecret : mockAKSec , region : "cn-hangzhou" }
134
+ encoded := signer .percentEncode ("123abc!@#$%^&*()-=_+ ~|\\ /" )
135
+ assert .Equal (s .T (), "123abc%21%40%23%24%25%5E%26%2A%28%29-%3D_%2B%20~%7C%5C%2F" , encoded )
136
+
137
+ encoded = signer .percentEncode ("!@#$%^&*()=-+ ~./_[()]%20你好\000 \u0111 ❤😓" )
138
+ assert .Equal (s .T (), "%21%40%23%24%25%5E%26%2A%28%29%3D-%2B%20~.%2F_%5B%28%29%5D%2520%E4%BD%A0%E5%A5%BD%00%C4%91%E2%9D%A4%F0%9F%98%93" , encoded )
139
+ }
140
+
130
141
func (s * SignerV4Suite ) TestSignV1Case1 () {
131
142
headers := map [string ]string {
132
143
"x-log-apiversion" : "0.6.0" ,
0 commit comments