Next.js Discord

Discord Forum

res.status(204).send() ?

Answered
Common Redpoll posted this in #help-forum
Open in Discord
Common RedpollOP
I set up a health api endpoint to check my app but it seems that the .send() function on NextApiResponse won't accept an empty body here. This is.. well, strange.. HTTP Status 204 is supposed to not send any content. It works as intended if i give it an empty object but.. what's the correct way to do this?
Answered by Ray
or use res.status(204).end()
View full answer

5 Replies

or use res.status(204).end()
Answer
Common RedpollOP
that looks more correct! 🙂
.end() - wow, how final 😄