TestZc_DctWServer
This commit is contained in:
parent
0823da7786
commit
990030fff3
|
@ -117,8 +117,7 @@ func (c *DctWServer) verify(authorization, path string, body []byte) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("时间戳获取失败")
|
||||
}
|
||||
calculatedSign := c.Sign(string(body), path, timestamp)
|
||||
if sign == calculatedSign {
|
||||
if sign == c.Sign(string(body), path, timestamp) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -144,8 +143,7 @@ func (c *DctWServer) VerifyDctW(authorization string, body []byte) error {
|
|||
}
|
||||
|
||||
signStr := fmt.Sprintf("%s%s%s", c.Config.AppId, string(body), c.Config.AppKey)
|
||||
calculatedSign := utils.Md5([]byte(signStr))
|
||||
if sign == calculatedSign {
|
||||
if sign == utils.Md5([]byte(signStr)) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,14 @@ import (
|
|||
)
|
||||
|
||||
func TestZc_DctWServer(t *testing.T) {
|
||||
server, err := NewDctWServer(&DctWConfig{
|
||||
server, err := NewDctWServer(
|
||||
&DctWConfig{
|
||||
AppId: "101",
|
||||
AppKey: "5k8bJV6axIukpkwz5vdte8QCw5etlC+txi+Nu69nIhOMN4VhmcNgf/THdllpt0jO",
|
||||
BaseUri: "http://openapi.1688sup.cn",
|
||||
})
|
||||
},
|
||||
WithDebug(true),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue