Can a HTTP 415 response have body?


#1

As of the title, I am curious if responding with a body of a JSON object that includes errors: [] is spec-compliant.

The spec states that

Servers MUST respond with a 415 Unsupported Media Type status code if a request specifies the header Content-Type: application/vnd.api+json with any media type parameters.

It does not have any details on the body of the response.

Thanks


#2

Yeah, responding with "errors" in the body should be ok! The spec doesn’t mandate exactly what the error’s title, code, etc. should be, so I think you can fill those in with your own values as appropriate (assuming they comply with the general rules for the meaning of those values).


#3

Thanks for the answer.

Moderator can close this topic now