mirror of
https://github.com/saltbo/zpan.git
synced 2026-09-21 13:20:33 +08:00
Dev (vite + miniflare + undici) returns 500 "fetch failed" when the Worker responds 401 to a POST with a body. undici follows the Fetch spec's HTTP-auth retry branch, which needs to re-extract the request body from its source — but the body comes from Node's IncomingMessage stream, so `body.source` is null and undici throws `expected non-null body source`. Production (direct CF edge) is unaffected, this only breaks local dev. 403 is also semantically more accurate: the client isn't performing HTTP authentication, just supplying a shared secret. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>