Skip to content

fix(proxy): preserve HTTP statuses for streaming errors - #841

Merged
SsuJojo merged 1 commit into
devfrom
fix/stream-error-status
Oct 8, 2026
Merged

SsuJojo merged 1 commit into
devfrom
fix/stream-error-status

Conversation

@SsuJojo

@SsuJojo SsuJojo commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserve the actual HTTP error status when a streaming request fails before its SSE response body starts. Previously, the shared SSE error helper emitted an error event but left Hono's default HTTP 200 status, so clients and reverse proxies could treat failures as successful responses.

Changes

  • Set the supplied HTTP status before opening the SSE response in src/routes/shared/stream-error-response.ts; this covers direct upstream transport failures (502), proxy errors, and no-account responses (503).
  • Add regression coverage for streaming 502/500/503 responses and update the Responses streaming 429 expectation to verify the upstream status is preserved.

Test Plan

  • Windows focused unit/integration/E2E tests — 59 passed across 5 files.
  • npx tsc --noEmit — passed on Windows.
  • npm test — attempted on Windows: 3210 passed, 25 failed, 25 skipped across 13 failed files. Failures include POSIX shell/path incompatibilities (/bin/sh unavailable and C:\... paths passed to bash), Electron hook timeouts, Windows EBUSY cleanup, and invalid-token errors in npm/release-notes tests. Full CI will run on GitHub.

Notes

The Windows full-suite failures are not asserted to be caused by this patch; the changed streaming status tests pass in the focused run.

@SsuJojo
SsuJojo merged commit 78a00be into dev Oct 8, 2026
4 checks passed
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