Per user report: 'Failed to execute text on Response: body stream already read'
при analyze запросе с error response.
## Root cause
apiFetchWithStatus делал:
1. await response.json() (consumes body stream даже на parse error)
2. catch → await response.text() ← FAILS — stream already consumed
fetch API: response body — ReadableStream, consumable один раз.
## Fix
Read text() once → attempt JSON.parse. Если parse failed (HTML error page
от Caddy / 502 / etc) — оборачиваем в {detail: rawText}. Никаких
double-reads.
## Impact
Любой non-JSON error response (502/504/HTML/etc) теперь показывает реальный
detail вместо misleading 'body stream' error.
Refs: user report 2026-05-14
|
||
|---|---|---|
| .. | ||
| public | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .eslintrc.json | ||
| Dockerfile | ||
| next-env.d.ts | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||