6
api.go
6
api.go
@@ -33,6 +33,8 @@ func (api CachetAPI) Ping() error {
|
||||
return errors.New("API Responded with non-200 status code")
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -49,6 +51,8 @@ func (api CachetAPI) SendMetric(id int, lag int64) {
|
||||
if err != nil || resp.StatusCode != 200 {
|
||||
logrus.Warnf("Could not log metric! ID: %d, err: %v", id, err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
|
||||
// TODO: test
|
||||
@@ -75,5 +79,7 @@ func (api CachetAPI) NewRequest(requestType, url string, reqBody []byte) (*http.
|
||||
}
|
||||
err = json.NewDecoder(res.Body).Decode(&body)
|
||||
|
||||
defer req.Body.Close()
|
||||
|
||||
return res, body, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user