Common HTTP Content-Type Headers and Their Use Cases

application/x-www-form-urlencoded

This is the default encoding standard for traditional HTML forms. Data is serialized into a query-string-like format where each parameter follows the parameterName=parameterValue syntax. Special characters are percent-encoded.

POST /submit-entry HTTP/1.1
Host: api.example.org
Content-Type: application/x-www-form-urlencoded; charset=utf-8

heading=sample&categories[]=alpha&categories[]=beta

multipart/form-data

Required when transmitting binary data or files alongside regular fields. The message body is divided into multiple parts using a unique delimiter boundary specified in the header. Each part carries its own metadata and raw payload.

<form action="/upload" method="post" enctype="multipart/form-data">
  <input type="hidden" name="request_id" value="req_9921">
  <input type="file" name="document_archive">
  <button type="submit">Send</button>
</form>

Corresponding server-side transmission:

POST /upload HTTP/1.1
Content-Length: 45201
Content-Type: multipart/form-data; boundary=----BoundaryMarkerX7Z

------BoundaryMarkerX7Z
Content-Disposition: form-data; name="request_id"

req_9921
------BoundaryMarkerX7Z
Content-Disposition: form-data; name="document_archive"; filename="report.pdf"
Content-Type: application/pdf

[binary stream contents]
------BoundaryMarkerX7Z--

application/json

Widely adopted for modern RESTful APIs, this type transmits structured data as a JavaScript Object Notation string. It supports complex nested objects and arrays natively without custom parsing logic on the client side.

POST /api/v2/users/profile HTTP/1.1
Content-Type: application/json; charset=utf-8

{
  "username": "dev_user",
  "settings": {
    "theme": "dark",
    "notifications": true
  },
  "roles": ["admin", "editor"]
}

text/xml

Historically used for SOAP protocols and remote procedure calls over HTTP. The payload contains strictly formatted XML markup representing method invocations, argmuents, and responses.

POST /rpc/endpoint HTTP/1.1
Content-Type: text/xml; charset="utf-8"

<?xml version="1.0"?>
<methodCall>
  <methodName>system.fetchLogs</methodName>
  <params>
    <param>
      <value><int>500</int></value>
    </param>
  </params>
</methodCall>

Supplementary Media Types

Web servers frequently handle various non-request-body formats across different stages of the HTTP pipeline:

MIME Type Description
text/html Standard web page markup
text/plain Unformatted ASCII/UTF-8 strings
image/gif / image/jpeg / image/png Raster graphics formats
application/pdf Portable Document Format
application/msword Legacy Microsoft Word documents
application/octet-stream Generic binary download streams
application/xml Structured XML data interchange

Tags: HTTP Content-Type web development API Design FormData

Posted on Wed, 24 Jun 2026 16:38:57 +0000 by Tedglen2