For certain resources, my RESTful server only accepts PUT and POST requests with JSON objects as the content body, thus requiring a Content-Type of application/json instead of application/x-www-form-urlencoded or multipart/form-data or anything else.
Malformed JSON (or lack thereof) returns a 400 with the error message taken directly from the exception raised by the JSON parser, for debugging purposes.
Which HTTP error code means that the client sent a request with an unacceptable Content-Type, even if the server could technically parse the request content?
It could be
415 Unsupported Media Typeaccording to this list: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16.3rd party edit
From the current RFC9110 HTTP Semantics
Source RFC9110 – 415 unsupported media type