I have an endpoint that requests the current logged in user.
GET /user/current
source
If a user is found, the server sends 200 OK
and the user object.
But what if no one is logged in? Should the server send back 200 Ok
with an empty object?
This post asked a similar question:
For example you run a GET request for users/9 but there is no user with id #9. Which is the best response code?
The top answer was 404 Not Found
. But this doesn't seem correct to me for a current user request with no logged in user. In this case the answer was found- the answer is that no user is logged in.