Unexpected end of JSON input
Answered
oguisantosilva posted this in #help-forum
I'm using postman to send a GET request with data in the body of the request, the problem is when i try to console.log the data in the body it says that de body is empty.
Can someone help?
Can someone help?
11 Replies
import { NextRequest, NextResponse } from "next/server"
export async function GET(request: Request, response: Response) {
const { data } = await request.json()
return NextResponse.json(data)
}you cant have a body in GET request
you can use POST however
Answer
using GET for login interaction is bad as it could lead to leaking sensitive information
omg im so dumb
thanks
@oguisantosilva omg im so dumb
hey now don't be so hard on yourself! we all have those moments