How to return 204 status code in route.js? #51475
-
Summary// app/test/route.js
export async function POST() {
return NextResponse.json(null,{
status: 204
})
} I got an error: Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Answered by
icyJoseph
Jun 19, 2023
Replies: 2 comments 8 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Just use the For example for a 200, export async function GET(request: Request) {
return new Response('Hello, Next.js!', {
status: 200,
})
} Or a 204: export async function GET(request: Request) {
return new Response(null, {
status: 204,
})
} |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
kmvan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just use the
new Response
form:For example for a 200,
Or a 204: