sajad torkamani

In a nutshell

A MIME type (aka media type) is metadata describing an HTTP resource type. User agents (e.g., web browsers) usually specify the MIME type of their request by including a Content-Type header (e.g., Content-Type: text/html). Web servers also add a Content-Type header to help user agents to render or manipulate the response correctly.

In short, here are some uses of a MIME type:

  • User agents (e.g., web browsers) determine what sort of data the server returned so they can render that data in an appropriate format.
  • Servers can restrict the type of data that a user agent can send (e.g., only json).
  • User agents can request a specific type of data (amongst many possibilities) from the server ( e.g., jsonhtmlxml, etc).

Check MIME type of a file on Unix systems

file --mime <some-file>

Example output:

hello.txt: Unicode text, UTF-8 text

Sources

Tagged: HTTP

Leave a comment

Your email address will not be published. Required fields are marked *