What is Content Type?
The Content-Type header determines the type of media the resource uses in an HTTP entity. A Content-Type is specified according to Multipurpose Email Extensions (MIME), which are standardized and published by the Internet Assigned Numbers Authority (IANA). A Content-Type header identifies the type, subtype, and optional parameters of the data in the body of an HTTP message.
What is MIME Type?
MIME (Multipurpose Internet Mail Extensions) is fundamental to communication protocols such as HTTP. Setting the correct MIME data type in the body of the message is critical for both HTTP requests and responses and allows you to control how the client and server interpret the request. Web servers and browsers have a list of well-known file extensions and MIME types. This helps them identify and decrypt all known file types, regardless of the operating system and hardware used by the user.
Client Request with Content-Type Header Example
The following is an example of an HTTP request to send a JSON string to the server. The "Content-Type: application/json" header tells the server that the request body contains a JSON string:
Server response to our Request with Content-Type Header: