The body’s format isn’t supported.
When to use it
Sending form data to a JSON endpoint, or a wrong Content-Type.
Common causes and fixes
The server can’t parse the body format, usually because Content-Type is missing or wrong: JSON sent without Content-Type: application/json (curl -d defaults to application/x-www-form-urlencoded), multipart form data posted to a JSON-only endpoint, or a charset or vendor type the server rejects. Spring and ASP.NET return 415 when no handler accepts the declared type.
Content-Encoding matters too: a gzip-compressed body sent to a server that doesn’t decompress requests gets 415. In browsers, fetch with a string body sends text/plain;charset=UTF-8 unless you set the header. Note that application/json triggers a CORS preflight while text/plain doesn’t. curl --json, available since 7.82, sets both Content-Type and Accept for you.
Client error (4xx)
4xx codes are client errors: the request itself is wrong, unauthorised or points at something that isn’t there. Retrying the same request won’t help.
What it looks like
HTTP/1.1 415 Unsupported Media TypeHow to send it
| Node.js / Express | res.status(415).end() |
|---|---|
| Python / Flask | return '', 415 |
| nginx | return 415; |
How to check it
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/