fix: server close

This commit is contained in:
tbphp
2025-07-09 17:24:13 +08:00
parent c2ab36912f
commit ae4644f287

View File

@@ -120,7 +120,7 @@ func (ps *ProxyServer) logRequest(c *gin.Context, group *models.Group, key *mode
// Close cleans up resources // Close cleans up resources
func (ps *ProxyServer) Close() { func (ps *ProxyServer) Close() {
// Nothing to close for now close(ps.requestLogChan)
} }
func (ps *ProxyServer) applyParamOverrides(c *gin.Context, group *models.Group) error { func (ps *ProxyServer) applyParamOverrides(c *gin.Context, group *models.Group) error {
@@ -129,7 +129,7 @@ func (ps *ProxyServer) applyParamOverrides(c *gin.Context, group *models.Group)
if err != nil { if err != nil {
return fmt.Errorf("failed to read request body: %w", err) return fmt.Errorf("failed to read request body: %w", err)
} }
c.Request.Body.Close() // Close the original body c.Request.Body.Close()
// If body is empty, nothing to override, just restore the body // If body is empty, nothing to override, just restore the body
if len(bodyBytes) == 0 { if len(bodyBytes) == 0 {