mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-03-30 02:11:54 +00:00
当客户端在流式响应过程中断开连接时,catch 块尝试发送 JSON 错误响应 会触发 ERR_HTTP_HEADERS_SENT 错误,导致 unhandledRejection 使服务崩溃。 修复文件: - src/routes/openaiClaudeRoutes.js - src/routes/openaiGeminiRoutes.js 修复内容: - 添加 res.headersSent 检查,避免在响应已发送后再次尝试发送 - 客户端断开连接使用 INFO 级别日志(不是 ERROR) - 客户端断开使用 499 状态码 (Client Closed Request) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>