My RESTFul API can only respond JSON-encoded data (i.e. all my headers have Content-Type: application/json
). What should I return, if the request has an Accept
header that does not allow JSON (for example, Accept: text/html
)? Should I just return a 400 Bad Request
with an explanation in the body, or is there a more specific status code for this exception?
Note that this is different from unsupported request content-types.