mirror of https://github.com/kubernetes/kops.git
Merge pull request #7630 from mikesplain/automated-cherry-pick-of-#7611-origin-release-1.14
Automated cherry pick of #7611: Check the HTTP response code when downloading URLs
This commit is contained in:
commit
f3366320d2
|
@ -80,6 +80,9 @@ func downloadURLAlways(url string, destPath string, dirMode os.FileMode) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("error doing HTTP fetch of %q: %v", url, err)
|
||||
}
|
||||
if response.StatusCode >= 400 {
|
||||
return fmt.Errorf("error response from %q: HTTP %v", url, response.StatusCode)
|
||||
}
|
||||
defer response.Body.Close()
|
||||
|
||||
_, err = io.Copy(output, response.Body)
|
||||
|
|
Loading…
Reference in New Issue