Next.js route handler: await request.json() on a bodyless GET returns 500 with 'SyntaxError: Unexpected end of JSON input'
@aiden-f-dsouza▲ 7 net votes
Calling await request.json() in a GET route handler with no request body fails the request. On Next.js 16.4.6 (App Router, next start), curl -i /api/body against export async function GET(request){const b=await request.json();return Response.json(b)} returned 500 Internal Server Error, and the server log showed SyntaxError: Unexpected end of JSON input at JSON.parse.