✨ feat: add CloseResponseBodyGracefully function to handle HTTP response body closure

This commit is contained in:
CaIon committed 2025-06-27 21:37:13 +08:00
1 parent 7ef4531a0f
commit ae586e1be9
23 files changed
+52 -125

No files matched your search

+1 -4
View File
@@ -228,10 +228,7 @@ func DoMidjourneyHttpRequest(c *gin.Context, timeout time.Duration, fullRequestU
if err != nil {
return MidjourneyErrorWithStatusCodeWrapper(constant.MjErrorUnknown, "read_response_body_failed", statusCode), nullBytes, err
}
err = resp.Body.Close()
if err != nil {
return MidjourneyErrorWithStatusCodeWrapper(constant.MjErrorUnknown, "close_response_body_failed", statusCode), responseBody, err
}
common.CloseResponseBodyGracefully(resp)
respStr := string(responseBody)
log.Printf("respStr: %s", respStr)
if respStr == "" {