🐛 fix: replace direct response body closure with common.CloseResponseBodyGracefully for improved error handling

This update standardizes the closure of HTTP response bodies across multiple stream handlers, enhancing error management and resource cleanup. The new method ensures that any errors during closure are handled gracefully, preventing potential request termination issues.
This commit is contained in:
CaIon
2025-06-27 21:40:36 +08:00
parent 3002659f47
commit 281054ff4c
7 changed files with 7 additions and 29 deletions

View File

@@ -81,10 +81,7 @@ func cfStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.Rela
}
helper.Done(c)
err := resp.Body.Close()
if err != nil {
common.LogError(c, "close_response_body_failed: "+err.Error())
}
common.CloseResponseBodyGracefully(resp)
return nil, usage
}