Skip to content

Commit

Permalink
Merge pull request #19 from irisnet/ht/fixTSL
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
MaricoHan authored May 15, 2022
2 parents 47e4250 + b978036 commit 554292f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions types/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ func GetTLSCertPool(gateWayURL string) ([]*x509.Certificate, error) {
client := &http.Client{Transport: tr}

resp, err := client.Get(gateWayURL)
defer func() {
closeErr := resp.Body.Close()
if err == nil {
err = closeErr
}
}()

if err != nil {
return nil, err
}
defer func() {
if resp != nil && err == nil {
err = resp.Body.Close()
}
}()

return resp.TLS.PeerCertificates, err
}

0 comments on commit 554292f

Please sign in to comment.