'Should I return null when only HTTP status code is important?

I'm programming a reset password system in nodejs + JWT. In some functions I dont't really need to send nothing as answer to the frontend, just is important the HTTP Status Code.. But i'm not sure if it's a good practice returning a null value.



Solution 1:[1]

you can use status code 204 instead

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204

Solution 2:[2]

Sure, that could work if the status code is the only information you need to convey in the request. There's even an Express method designed for exactly this - to send the status code (and in the body the corresponding message for the code, just in case it's useful, though you're free to ignore it). See res.sendStatus. sendStatus would be a bit more appropriate than .send(null) though.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ranga D
Solution 2 CertainPerformance