What (if any) http status code is returned when a MIME type is missing?
Asked Answered
C

1

9

If a web server doesn't have a MIME type added for a file that a client tries to download, what (if any) http status code would be returned?

It suggests here it could be 415, although the answer isn't definite:

HTTP status code for unaccepted Content-Type in request

Chlorophyll answered 17/10, 2013 at 3:7 Comment(0)
H
11

The answer is "415 Unsupported Media Type" if your question is "what is the correct status code for a request if its body is content-encoded in the media type the server cannot accept."

RFC 2616 and draft-ietf-httpbis-p2-semantics-21.txt says:

If the content-coding of an entity in a request message is not
acceptable to the origin server, the server SHOULD respond with a
status code of 415 (Unsupported Media Type).

But If your question is "what is the correct status code if the server cannot respond with an entity body which is content-encoded in the media-type requested by Accept request header", the answer is "406 Not Acceptable"

RFC 2616 says:

If no Accept header field is present, then it is assumed that the
client accepts all media types. If an Accept header field is present, and if the server cannot send a response which is acceptable
according to the combined Accept field value, then the server SHOULD
send a 406 (not acceptable) response.

Harkey answered 20/10, 2013 at 17:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.