From d34156bfe6e17753f5c49068c793c05408c81d72 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Wed, 7 Oct 2020 22:55:53 -0700 Subject: [PATCH] Add close to the body for e2e test (#7450) * Add close to the body for e2e test * Add error handling to defer * Remove extra line Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- endtoend/helpers/helpers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/endtoend/helpers/helpers.go b/endtoend/helpers/helpers.go index 1b4bb41cc..3e541f807 100644 --- a/endtoend/helpers/helpers.go +++ b/endtoend/helpers/helpers.go @@ -171,6 +171,12 @@ func writeURLRespAtPath(url string, filePath string) error { if err != nil { return err } + defer func() { + if err := resp.Body.Close(); err != nil { + return + } + }() + body, err := ioutil.ReadAll(resp.Body) if err != nil { return err