Merge pull request #99 from jehiah/http_head_error_99

Handle HEAD request errors
This commit is contained in:
Matt Holt 2016-02-06 13:20:50 -07:00
commit 1198444908

View file

@ -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
} }