Response body must not be closed if request error'd.
This commit is contained in:
parent
51d77516a5
commit
321ceaa0da
@ -26,10 +26,10 @@ func SSHImportKeysFromURL(system_user string, url string) error {
|
|||||||
|
|
||||||
func fetchUserKeys(url string) ([]string, error) {
|
func fetchUserKeys(url string) ([]string, error) {
|
||||||
res, err := http.Get(url)
|
res, err := http.Get(url)
|
||||||
defer res.Body.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
body, err := ioutil.ReadAll(res.Body)
|
body, err := ioutil.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user