forked from TrueCloudLab/lego
httpHead: return error before referencying resp.Body
This commit is contained in:
parent
be4e74d1aa
commit
9dc7fa9d52
1 changed files with 3 additions and 2 deletions
|
@ -33,9 +33,10 @@ func httpHead(url string) (resp *http.Response, err error) {
|
||||||
req.Header.Set("User-Agent", userAgent())
|
req.Header.Set("User-Agent", userAgent())
|
||||||
|
|
||||||
resp, err = http.DefaultClient.Do(req)
|
resp, err = http.DefaultClient.Do(req)
|
||||||
if resp.Body != nil {
|
if err != nil {
|
||||||
resp.Body.Close()
|
return resp, err
|
||||||
}
|
}
|
||||||
|
resp.Body.Close()
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue