fixes try to clode Body even if error is not nil

fixes: https://github.com/xsteadfastx/jitsiexporter/issues/3
This commit is contained in:
Marvin Steadfast 2020-04-15 12:34:04 +02:00
parent bac054fa0d
commit 6f20bf101a

View File

@ -134,8 +134,6 @@ func (c colibri) Now(url string) (map[string]interface{}, error) {
case r := <-res: case r := <-res:
err = r.Error err = r.Error
resp = r.Resp resp = r.Resp
defer resp.Body.Close()
} }
if err != nil { if err != nil {
@ -148,6 +146,8 @@ func (c colibri) Now(url string) (map[string]interface{}, error) {
return nil, err return nil, err
} }
defer resp.Body.Close()
return s, nil return s, nil
} }