Practical Implementations

Media types are used in HTTP headers such as the Accept request header and the Content-Type entity header. They are also used to relay information about the content of Internet mail messages (email).

The Content-Type entity header specifies the media type of the HTTP message content. For example, consider the following HTTP response:

HTTP/1.1 200 OK 
Content-Type: text/html 
Content-Length: 19 

<p>This is HTML</p> 

The content (<p>This is HTML</p>) is declared to be of media type text/html. This allows the Web client to properly identify and handle the resource. If the resource being requested is named index.html, it may seem that this declaration is unnecessary, because the file extension should indicate the file type. ...

Get HTTP Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.