From 6f20bf101a29a64cd080cecbaec54f060dcd3533 Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Wed, 15 Apr 2020 12:34:04 +0200 Subject: [PATCH] fixes try to clode Body even if error is not nil fixes: https://github.com/xsteadfastx/jitsiexporter/issues/3 --- jitsiexporter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jitsiexporter.go b/jitsiexporter.go index affcacd..3ab96c9 100644 --- a/jitsiexporter.go +++ b/jitsiexporter.go @@ -134,8 +134,6 @@ func (c colibri) Now(url string) (map[string]interface{}, error) { case r := <-res: err = r.Error resp = r.Resp - - defer resp.Body.Close() } if err != nil { @@ -148,6 +146,8 @@ func (c colibri) Now(url string) (map[string]interface{}, error) { return nil, err } + defer resp.Body.Close() + return s, nil }