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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user