This is an idea that simply makes sense (if your resource returns JSON, your 404 should be JSON too) but it doesn’t…

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

About time!

_For some reason dev.twitter.com pages can’t be +1’d in Google Chrome _

https://dev.twitter.com/blog/making-api-responses-match-request-content-type

2 replies on “This is an idea that simply makes sense (if your resource returns JSON, your 404 should be JSON too) but it doesn’t…”

  1. 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.