views:

198

answers:

0

If a server always responds with 204 after a successful HTTP DELETE, when is it appropriate to require clients to send an Accept header?

It seems like the correct behavior would be to never require an Accept header.

The reason I ask is that when developing a RESTful Rails application, if the Accept header is unset, Rails defaults to HTML as the mime type. So it doesn't seem possible using respond_to to enable a scenario where the Accept header is blank and reqested mime type is anything other than html. With HTML, you'd typically have a redirect, but with an API, you'd just return 204.

Of course, it's possible to get around this by using some other method than respond_to for deciding if a browser made the request (such as checking for a session), but that seems like a hack.

Any ideas?