Content-Type
Indicates the media type of the request or response body. Includes optional charset for text types.
BothSyntax
Content-Type: <media-type>; charset=<encoding>Example values
| Value | Explanation |
|---|---|
| application/json | JSON payload |
| application/x-www-form-urlencoded | Form data |
| multipart/form-data; boundary=----WebKitFormBoundary | File upload |
| text/html; charset=utf-8 | HTML with charset |
cURL usage
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.comCommon mistakes
Forgetting Content-Type for JSON (server may not parse); wrong charset for non-UTF-8.