Content-Type Header

Table of Content

The Content-Type header is an entity-header in HTTP used to indicate the media type of the resource. It informs the client about the type of data the server will send back in response to the request made by the client. When used in request headers, it tells the server what type of data is being sent in the body of the request.

Syntax

Content-Type: mediaType/subType

Directives

In the Content-Type HTTP header, directives include specification of mediaType and subType along with optional parameters like charset, boundary, etc. The mediaType indicates the category of file type while subType specifies the exact file type. For instance, in Content-Type: text/html, text is the mediaType and html is the subType.

Examples

Content-Type: text/html; charset=UTF-8
Content-Type: multipart/form-data; boundary=something

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Content-Type header

ModHeader is a Chrome extension that can be used to modify HTTP request headers, including the Content-Type. To use ModHeader to modify the Content-Type header:

  1. Install the ModHeader extension from the Chrome Web Store.

  2. Click on the ModHeader icon to bring up the ModHeader pop-up window.

  3. Click on "+ Add" near the Request Headers section.

  4. In the empty boxes that appear, input 'Content-Type' in the 'Name' field and the desired media type in the 'Value' field.

By doing this, all your subsequent client requests will have its Content-Type header set to whatever you specified in ModHeader. This is particularly useful for developers, as it allows them to emulate different data types being sent to the server and observe the server's response.