mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-08 00:02:20 +03:00
Non-stream Codex (ChatGPT account) chat 502'd with "Response body is already used". On the wreq-js TLS-fingerprint transport the Response is backed by a native body handle, and merely accessing response.body disturbs it so a later .text() throws. The Codex non-stream upstream response has an empty content-type, so peekCodexSseTransientError early-returns — but its guard evaluated !response.body (touching .body) before the content-type check, consuming the body; chatCore's readNonStreamingResponseBody then re-read it and 502'd. Streaming was unaffected. Reorder the guard to check content-type first. Validated live on the VPS (192.168.0.15): codex/gpt-5.5 and codex/gpt-5.6-terra non-stream now return 200; streaming still works. Regression test drives the real peek with a destructive-.body mock.