Skip to content
Permalink
Browse files
Merge pull request #40 from svanharmelen/dev
Make closing the body a little more robust
  • Loading branch information
Sander van Harmelen committed Oct 13, 2015
2 parents b1dd576 + 7058e8c commit 0320f0354c6d354bf7e4b645332903a462178792
Showing 4 changed files with 4 additions and 4 deletions.
@@ -299,9 +299,9 @@ func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawM
if err != nil {
return nil, err
}
defer resp.Body.Close()

b, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, err
}
@@ -306,9 +306,9 @@ func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawM
if err != nil {
return nil, err
}
defer resp.Body.Close()

b, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, err
}
@@ -299,9 +299,9 @@ func (cs *CloudStackClient) newRequest(api string, params url.Values) (json.RawM
if err != nil {
return nil, err
}
defer resp.Body.Close()

b, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, err
}
@@ -391,9 +391,9 @@ func (as *allServices) GeneralCode() ([]byte, error) {
pn(" if err != nil {")
pn(" return nil, err")
pn(" }")
pn(" defer resp.Body.Close()")
pn("")
pn(" b, err := ioutil.ReadAll(resp.Body)")
pn(" resp.Body.Close()")
pn(" if err != nil {")
pn(" return nil, err")
pn(" }")

0 comments on commit 0320f03

Please sign in to comment.