Content · Request & Response
Content-Type
Declares the media type of the body.
What is Content-Type?
Content-Type tells the receiver how to interpret the bytes in the message body — as JSON, HTML, an image, a video, and so on. Almost every request with a body and every response with content must set it correctly, or the client / browser will misinterpret the payload.
Typical usage
Always set on responses with a body; also required on POST / PUT / PATCH requests that carry a body.
Examples
JSON body
Content-Type: application/jsonHTML page (with charset)
Content-Type: text/html; charset=utf-8Form with file upload
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary...Common gotchas
Serving a script or stylesheet with the wrong Content-Type causes the browser to reject it silently. Always match the actual bytes — a .css file must be sent as text/css.
Specification
RFC 9110 §8.3