Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaricoHan committed May 15, 2022
1 parent 47e4250 commit b978036
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 b978036

Please sign in to comment.