mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-28 13:48:49 +08:00
Close response body properly (#143)
This commit is contained in:
parent
4f467dcdde
commit
7cc03be424
@ -68,11 +68,10 @@ func (mc ManagerClient) makeRequest(url, token string) (string, error) {
|
|||||||
mgReq.Header.Set("Authorization", token)
|
mgReq.Header.Set("Authorization", token)
|
||||||
|
|
||||||
res, err := hc.Do(mgReq)
|
res, err := hc.Do(mgReq)
|
||||||
defer res.Body.Close()
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", ErrServiceUnreachable
|
return "", ErrServiceUnreachable
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
if res.StatusCode != http.StatusOK {
|
if res.StatusCode != http.StatusOK {
|
||||||
return manager.ErrUnauthorizedAccess, nil
|
return manager.ErrUnauthorizedAccess, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user