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?