This post originated from an RSS feed registered with Ruby Buzz
by .
Original Post: Need Help on HTTP Status Code
Feed Title: cfis
Feed URL: http://cfis.savagexi.com/articles.rss
Feed Description: Charlie's Blog
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by
Latest Posts From cfis
Advertisement
Imagine the following situation:
You have an HTML sign up form for a user.
One of the fields is for the user’s email.
The user fills in the data and POSTs the response to the server.
The server rejects the request, perhaps the email address is already taken.
Is there an appropriate HTTP status code for this? It seems to me this falls into the 4xx range since the client provided invalid data. Its not a 400 though since the server understood the request. And none of the other 4xx codes seem to fit.
I ran into a similar situation today, except that I’m doing it via an XmlHttpRequest. When posting some data to the server, the request always returns HTTP status code 200 whether or not data was actually inserted into the backend database. Thus, the server has to return back a response that tells the client what happened - probably via a little bit of JavaScript. But it seems like using an HTTP status code would be a much cleaner solution.
Any ideas? Or am I trying to misuse HTTP status codes?