Close HTTP client request body to prevent memory leaks.

This commit is contained in:
Adrian Gallagher
2015-03-14 16:03:05 +11:00
parent 2e13fae287
commit 6e6542001a
11 changed files with 14 additions and 14 deletions

View File

@@ -280,6 +280,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
client := &http.Client{}
resp, err := client.Do(req)
defer resp.Body.Close()
if err != nil {
return errors.New("SendAuthenticatedHTTPRequest: Unable to send request")
@@ -291,6 +292,5 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params
log.Printf("Recieved raw: %s\n", string(contents))
}
resp.Body.Close()
return nil
}