FIX Discard Response Body, to clean up tcp socket

master
cheetah 2 years ago
parent be43899785
commit fbbf0b0ea6

@ -134,6 +134,14 @@ func MultipartUpload(client *http.Client, url string, path string) (err error) {
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
return fmt.Errorf("bad status: %s", res.Status) 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 return
} }

Loading…
Cancel
Save