2009/7/23 John Resig <jere...@gmail.com>: > I guess that's a tangential issue, not really related to JSON - if a server > returns a 204 (with no content) should we call success with a null or > undefined data argument? > > At the moment I think that's far more likely that when you do a request, and > you're expecting something (JSON, XML, etc.) and you don't get it (204 or > not), that it should not count as a success. I'd be willing to tweak the > docs to represent that. Of course, I'm willing to be convinced otherwise. >
As 204 No Content is clearly defined as a success in HTTP, it certainly should not be treated as an error. Any application that has the expectation of receiving a 204 when making a request expecting JSON would be prepared for such an eventuality. As a request specifying JSON as the response content type is, in fact, expecting to receive an object on success, and as the value null is equivalent to "this object does not exist" (hence, typeof null === "object"), a 204 response to a request expecting JSON should logically be treated as a success, with a response value of null. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---