This is an idea that simply makes sense (if your resource returns JSON, your 404 should be JSON too) but it doesn’t seem likely to me that it will be widely implemented.
In particular, 503 Service Unavailable??? How the heck is your load balancer supposed to know that your ‘PUT /frobble/blatz’ is supposed to return JSON? Should it just assume that the response content type should match the request content type?
Originally shared by Abraham Williams
_For some reason dev.twitter.com pages can’t be +1’d in Google Chrome _
I agree; this is good practice! Could you by chance base your response on the Accept headers?
Rob Hoelz, yes of course… That seems so obvious in retrospect. I wonder why I didn’t think of that when I first posted? I use that technique today with JAX-RS to auto-generate the Accept header for client code that matches the documented @Produces content type for the server.
Comments are closed.