Make the web API honor the Accept header from the request in case of 404
Currently, a web API call that returns a 404 will always return text/html
content instead of application/json
(which should be the default when not browsing from a browser), even if the Accept
header is explicitly set.
This is pretty annoying when using the API from cli tools (e.g. httpie).