Skip to content

Commit

Permalink
天翼云请求优化
Browse files Browse the repository at this point in the history
  • Loading branch information
libsgh committed Jul 5, 2021
1 parent b4982cb commit c333e8e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Util/Cloud189.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ func GetDownlaodUrl(accountId, fileIdDigest string) string {
log.Error(err)
return ""
}
if dRedirectRep != nil {
defer dRedirectRep.Body.Close()
}
redirectUrl := dRedirectRep.Header.Get("Location")
dRedirectRep, err = CLoud189Session.Get(redirectUrl, nic.H{
AllowRedirect: false,
Expand Down Expand Up @@ -248,7 +251,11 @@ func Cloud189IsLogin(accountId string) bool {
if err == nil && resp.Text != "" && jsoniter.Valid(resp.Bytes) && jsoniter.Get(resp.Bytes, "errorMsg").ToString() == "" {
return true
} else {
log.Debug(resp.Text)
if resp != nil {
defer resp.Body.Close()
} else {
log.Debug(resp.Text)
}
}
}
return false
Expand Down

0 comments on commit c333e8e

Please sign in to comment.