frontend: skip body in proxy for 204/205/304 responses

Response constructor rejects bodies on these statuses, so DELETE
returning 204 was triggering a 500 in the proxy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
root
2026-05-02 23:12:34 +00:00
parent 694b02e848
commit 3a95c3e93f

View File

@@ -31,7 +31,9 @@ async function handler(
body,
});
const data = await res.arrayBuffer();
// Per Fetch spec, Response with 204/205/304 must not have a body.
const hasBody = res.status !== 204 && res.status !== 205 && res.status !== 304;
const data = hasBody ? await res.arrayBuffer() : null;
return new NextResponse(data, {
status: res.status,