When you see this status
- Client sends JSON but sets Content-Type: text/plain
- Client sends XML but sets Content-Type: application/json
- Client omits Content-Type header entirely
- Server expects multipart/form-data but receives application/json
Common causes
- Missing or incorrect Content-Type header
- Client sends data in unsupported format
- Server misconfigured media type handling
- Client sends empty body with non-empty Content-Type
How to debug it
- Verify Content-Type header matches actual payload format
- Check server-side media type parser configuration
- Inspect raw request headers and body
- Test with curl: curl -v -H 'Content-Type: application/json' ...
Return this code in your framework
Express (Node.js)
res.status(415).send('Unsupported Media Type');
FastAPI (Python)
from fastapi import HTTPException
raise HTTPException(status_code=415, detail="Unsupported Media Type")
NestJS
@Get() getData(@Body() data: any) {
throw new UnsupportedMediaTypeException();
}
Go (net/http)
w.WriteHeader(http.StatusUnsupportedMediaType)
w.Write([]byte("Unsupported Media Type"))
About HTTP 415
HTTP status code 415 Unsupported Media Type is part of the
4xx Client Error family. Server refuses request due to unsupported media type in Content-Type header. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.