Skip to content

Commit 59d4f79

Browse files
committed
fix: 修复读取响应体时的变量命名错误
1 parent 2ba378f commit 59d4f79

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/proxy/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,12 @@ func (ps *ProxyServer) executeRequestWithRetry(c *gin.Context, startTime time.Ti
344344

345345
// Read response body to get error information
346346
var errorMessage string
347-
bodyBytes, err := io.ReadAll(resp.Body)
347+
errorBodyBytes, err := io.ReadAll(resp.Body)
348348
if err != nil {
349349
errorMessage = fmt.Sprintf("HTTP %d (failed to read body: %v)", resp.StatusCode, err)
350350
} else {
351351
if resp.Header.Get("Content-Encoding") == "gzip" {
352-
reader, gErr := gzip.NewReader(bytes.NewReader(bodyBytes))
352+
reader, gErr := gzip.NewReader(bytes.NewReader(errorBodyBytes))
353353
if gErr != nil {
354354
errorMessage = fmt.Sprintf("gzip reader error: %v", gErr)
355355
} else {
@@ -362,7 +362,7 @@ func (ps *ProxyServer) executeRequestWithRetry(c *gin.Context, startTime time.Ti
362362
}
363363
}
364364
} else {
365-
errorMessage = string(bodyBytes)
365+
errorMessage = string(errorBodyBytes)
366366
}
367367
}
368368

0 commit comments

Comments
 (0)