The HTTP Content-Type header indicates the original media type of the resource.
The HTTP Content-Type header is used to inform the client concerning the resource’s original media type. The distinction is necessary because pre-transmission, the server or intermediaries can apply one or more Content-Encoding methods. The representation that arrives may need to be revered to the original before it can be used.
The directives for the HTTP Content-Type header are the
media type is a valid MIME type, and a complete list is maintained by IANA.
In the first example, the original
media type is
text/html and uses the
UTF-8 character set. Because servers are encouraged to compress resources pre-transmission, HTML files are routinely compressed. The client will use the Content-Encoding header to determine how to return their representation to the one specified by the Content-Type header.
Content-Type: text/html; charset=UTF-8
In the second example, a
multipart response is sent. Each of the sections is separated by the specified
boundary phrase. In this case, the
boundary between parts is "-----".
Content-Type: multipart/form-data; boundary=-----
The Content-Type header is used to inform the client as to the original, pre-encoded media type of the resource.