fix: Closing bddy multiple times

This commit is contained in:
minoplhy 2024-04-16 14:17:23 +07:00
parent f28f2fb72a
commit 3eddc23eb6
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF

View File

@ -55,7 +55,6 @@ func UploadPost(BasePath string, headers map[string]string, PostData UploadPostM
if resp.StatusCode == http.StatusOK {
buffer := bytes.NewBuffer(nil)
_, err := io.Copy(buffer, resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
}
@ -98,11 +97,11 @@ func NetworkStoragePut(URL string, ContentType string, filepath string) ([]byte,
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
buffer := bytes.NewBuffer(nil)
_, err := io.Copy(buffer, resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
}
@ -130,11 +129,11 @@ func UploadProcessPost(BasePath string, headers map[string]string, PostData Uplo
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
buffer := bytes.NewBuffer(nil)
_, err := io.Copy(buffer, resp.Body)
defer resp.Body.Close()
if err != nil {
return nil, err
}