From fbbf0b0ea6d5165b6958a1bf88d79d6d4652479f Mon Sep 17 00:00:00 2001 From: cheetah Date: Sun, 25 Jun 2023 02:59:28 -0500 Subject: [PATCH] FIX Discard Response Body, to clean up tcp socket --- common/common.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/common.go b/common/common.go index 32ea67b..693e89d 100644 --- a/common/common.go +++ b/common/common.go @@ -134,6 +134,14 @@ func MultipartUpload(client *http.Client, url string, path string) (err error) { if res.StatusCode != http.StatusOK { return fmt.Errorf("bad status: %s", res.Status) } + + // Discard Response Body, to clean up tcp socket + defer res.Body.Close() + _, err = io.Copy(ioutil.Discard, res.Body) + if err != nil { + return err + } + return }