I stumbled upon this, and think that many do not know the reason we need a 204 status.
204 No Content is merely a confirmation that the request has been understood and acted upon correctly.
Think of it like toggling tick-boxes on a web-page, rating stars, the browser shouldn't be updated after the PUT request, the user-interface already displays the new resource state.
if a search or list on a specific resource ends up in an empty list, return the empty list! a 200 OK! If that would be a list of words, Content-Length = 0!
What if the client expects a XML doc? Some DTD's or Schema's do mandate the <LIST></LIST> and is not optional, however the <ELEMENT></ELEMENT> occurrence would be zero. Do not send nothing, the client gets confused, all it wants is the response and iterate over the LIST
204, also perfect after a DELETE request where one clicks on a X at the end of a row and the UI nicely animates the deletion. The browser is expected to stay on that page.
Op donderdag 13 februari 2014 16:34:50 UTC schreef John McCarthy: