Content-Type Header
Pronunciation: KON-tent type HED-er
Also known as: HTTP Content-Type Header, Media Type Header
Definition
Content-Type Header is an HTTP representation header that identifies the media type and relevant parameters of the message body being sent. Content-Type states what the current body is, while Accept describes which response formats the client prefers. A production implementation should send an explicit supported media type, validate it before parsing, define charset behavior where relevant, reject conflicting bodies, and ensure signatures are calculated over the exact representation. The principal risks include parser confusion, incorrect deserialization, content sniffing, signature mismatch, unsupported formats accepted silently, and security controls applied to a different interpretation of the body.
Overview
Content-Type Header is an HTTP representation header that identifies the media type and relevant parameters of the message body being sent. Content-Type states what the current body is, while Accept describes which response formats the client prefers.
The principal risks include parser confusion, incorrect deserialization, content sniffing, signature mismatch, unsupported formats accepted silently, and security controls applied to a different interpretation of the body. The Content-Type Header contract should define identifiers, validation, authorization, status semantics, errors, limits, and version behavior at the same boundary.
A production implementation should send an explicit supported media type, validate it before parsing, define charset behavior where relevant, reject conflicting bodies, and ensure signatures are calculated over the exact representation. For Content-Type Header, the application should preserve a correlation path from request construction through response, asynchronous completion, and final business state.
Useful measures include unsupported-media-type responses, parsing errors, missing-header rate, signature failures by media type, and client usage by content type. Content-Type Header is closely connected to Accept Header, Payload Signature, and Request Schema.
Changes to Content-Type Header should be checked against older clients, stored payloads, enum growth, default behavior, and retry assumptions. Observability for Content-Type Header should record operation, version, principal, request ID, latency, retry count, error code, and final state without exposing secrets.
Testing Content-Type Header should cover malformed input, denied access, rate limits, timeouts, duplicates, asynchronous completion, and version changes. The Content-Type Header owner should publish stable error semantics and guidance on whether correction, retry, status lookup, or escalation is appropriate. Data handled by Content-Type Header should use documented types, units, timestamp rules, nullable fields, and enum behavior to prevent silent interpretation errors.
Key Takeaway
Send an explicit supported media type, validate it before parsing, define charset behavior where relevant, reject conflicting bodies, and ensure signatures are calculated over the exact representation.
Sources
- HTTP Semantics — IETF (2026-08-03)
- OpenAPI Specification — OpenAPI Initiative (2026-08-03)
- OWASP API Security Top 10 - 2023 — OWASP (2026-08-03)