How to handle a "no action required" HTTP response

Viewed 2542

I have an angular application. When a user logs in, the application sends a username/token pair off to an API route on a .NET backend.

If the username/token pair doesn't exist, the .NET application adds it to the database and returns a Created() response.

However, if the pair does exist (and it likely will), then no action is required and nothing is Created(). In this case, what response should I return?

Alternate solution: I could run two requests against the API, one GET to see if the user/tokan pair exists and then a POST request if it does not, but that isn't as efficient, requires nested promises and is generally not as pretty. Maybe preferable anyway?

2 Answers
Related