Skip to content

fix(proxy): fail over on empty upstream responses - #246

Merged
g1331 merged 1 commit into
masterfrom
fix/proxy-empty-upstream-response
Aug 3, 2026
Merged

fix(proxy): fail over on empty upstream responses#246
g1331 merged 1 commit into
masterfrom
fix/proxy-empty-upstream-response

Conversation

@g1331

@g1331 g1331 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

修复上游返回空响应时被透传到下游的问题。成功但空 body 的非流式响应,以及没有产生有效内容就结束的 SSE 流,都会在响应提交前触发故障转移。

Related Issue

未关联具体 Issue。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Tests (adding or updating tests)

Changes

  • 新增 UpstreamEmptyResponseError,拦截成功状态下的空非流式响应。
  • 空 SSE 流不再依赖 firstByteTimeout 配置才进行检测。
  • 将空响应加入现有故障转移、失败记录和失败规则类型。
  • 增加 proxy-client 与代理路由回归测试,并补充中英文显示文本。

Test Plan

  • Local tests pass(相关单元测试:proxy-client 94/94,代理路由 88 通过)
  • Type check passes(pnpm exec tsc --noEmit
  • Lint passes(相关文件 ESLint;提交钩子 ESLint)
  • Manual testing completed

Checklist

  • Code follows the project's coding standards
  • Tests have been added where necessary
  • Documentation has been updated(不适用)
  • Changes do not introduce security vulnerabilities
  • Commit messages follow conventions

Screenshots

不适用。

Additional Notes

截图中的 HTTP 499 仍表示下游客户端断开,不属于本次空响应错误。

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.13%. Comparing base (e391757) to head (33e804a).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #246      +/-   ##
==========================================
+ Coverage   72.09%   72.13%   +0.04%     
==========================================
  Files         243      243              
  Lines       14147    14152       +5     
  Branches     4674     4676       +2     
==========================================
+ Hits        10199    10209      +10     
  Misses       2598     2598              
+ Partials     1350     1345       -5     
Flag Coverage Δ
verify 72.13% <93.33%> (+0.04%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@g1331
g1331 force-pushed the fix/proxy-empty-upstream-response branch from 6012ccc to 33e804a Compare August 3, 2026 05:02
@g1331
g1331 merged commit c18bb44 into master Aug 3, 2026
12 checks passed
@g1331
g1331 deleted the fix/proxy-empty-upstream-response branch August 3, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant