From 3eddc23eb6eaf628d603e1846fa18d11a4faf755 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Tue, 16 Apr 2024 14:17:23 +0700 Subject: [PATCH] fix: Closing bddy multiple times --- src/handler/chibisafe.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/handler/chibisafe.go b/src/handler/chibisafe.go index b1d1cab..f744ab9 100644 --- a/src/handler/chibisafe.go +++ b/src/handler/chibisafe.go @@ -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 }