the supremacy of mime types

2008-02-23 @ 17:31#

i read an excellent post on the place that mime types have in the web world - esp. REST-ful web. the opening sentence makes the key point:

MIME is the corner stone of document type identification on the Web today

i will admit it took me quite some time to come to agreement on this. for the longest time, i consdered URLs (most esp. the 'file extension') to be the primary arbiter of content types on the web. if the URL ended with .html i knew what to expect. if it ended with .jpg i knew what to expect, etc. but that is missing a key point. what do you expect when you see .xml? Atom? RSS? what about some other custom XML document?

the mime-type can tell you much more - that's what it is designed to do. application/json, application/atom+xml, etc. in fact, in my most recent project, i've removed the file extension completely from all URLs. this has forced me to give much more weight to the mime-type (via the accept and content-type headers). and that's a good thing.

benjamin's ending remarks regarding his practice of "mak[ing] up media types for special-purpose applications" is something i've contemplated for a while, too. it really makes sense. if i want to stick to the position that mime-types are important then i need to make sure the mime-types i use are meaningful. and it turns out that text/xml is not very meaningful.

code