feat: add CloseResponseBodyGracefully function to handle HTTP response body closure

This commit is contained in:
CaIon
2025-06-27 21:37:13 +08:00
parent 647f8d7958
commit 3002659f47
23 changed files with 52 additions and 125 deletions

View File

@@ -90,10 +90,7 @@ func RelayErrorHandler(resp *http.Response, showBodyWhenFail bool) (errWithStatu
if err != nil {
return
}
err = resp.Body.Close()
if err != nil {
return
}
common.CloseResponseBodyGracefully(resp)
var errResponse dto.GeneralErrorResponse
err = json.Unmarshal(responseBody, &errResponse)
if err != nil {