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>
This commit is contained in:
terence tsao
2020-10-07 22:55:53 -07:00
committed by GitHub
parent 7c8492e83f
commit d34156bfe6

View File

@@ -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