mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-13 00:01:35 +08:00
Replace the substring-based data:/event: SSE heuristic in handleNonStreamingResponse with bodyHasSSEFraming, a line-level check that only matches when a physical line starts with the SSE data:/ event: field names. This prevents OAuth compact JSON responses whose output text merely contains the literal substrings "data:" or "event:" from being misrouted into handleSSEToJSON, which was causing usage to be recorded as zero even though the JSON body itself carries a valid top-level usage object. Content-Type: text/event-stream detection and genuine SSE body handling are unaffected.