how do i change the response code on my NextResponses in nextjs13
Unanswered
New Guinea Freshwater Crocodile posted this in #help-forum
New Guinea Freshwater CrocodileOP
i do this
but this doesnt give back the Error code when trying out that route with postman for example
NextResponse.json({ status: 401, message: 'Unauthorized' })but this doesnt give back the Error code when trying out that route with postman for example
2 Replies
@New Guinea Freshwater Crocodile i do this
NextResponse.json({ status: 401, message: 'Unauthorized' })
but this doesnt give back the Error code when trying out that route with postman for example
return NextResponse.json({ message: 'Unauthorized' }, { status: 401 })should return status
401 and json { message: 'Unauthorized' }New Guinea Freshwater CrocodileOP
indeed works ty