Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Jan 21, 2026

Summary

  • Fix wujie fetch interceptor losing custom headers (like trpc-accept) when rewriting URLs
  • This caused tRPC streaming responses to fail in wujie containers while working correctly in standalone mode

Root Cause

The fetch interceptor was using window.fetch(rewrittenUrl, init) where init might not contain the complete headers from the original Request object. When tRPC sends requests with trpc-accept: application/jsonl, this header was lost, causing the server to return traditional JSON instead of streaming JSONL.

Fix

Changed from:

return window.fetch(rewrittenUrl, init);

To:

return window.fetch(new Request(rewrittenUrl, req));

This preserves the original request's complete configuration including all headers.

The fetch interceptor was losing custom headers (like tRPC's trpc-accept)
when rewriting URLs. This caused tRPC streaming responses to fail in
wujie containers while working correctly in standalone mode.

Fix: Use new Request(rewrittenUrl, req) to preserve the original
request's complete configuration including headers.
@Gaubee Gaubee merged commit 2386556 into main Jan 21, 2026
5 checks passed
@Gaubee Gaubee deleted the opencode/stellar-cabin branch January 21, 2026 16:10
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.

2 participants