HTTP 415 Unsupported Media Type means the server cannot process the request body's media type (Content-Type). Common triggers: sending JSON with Content-Type: text/plain, sending form data to a JSON-only endpoint, or uploading an unsupported file format. The server should indicate which media types it accepts in the response body or Accept-Post/Accept-Patch headers.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/415
Example request:
curl -i "https://httpstatus.com/api/status/415"The request entity has a media type which the server or resource does not support.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 415 Unsupported Media Type has specific technical implications for API design, caching, and client behavior. Understanding the precise semantics helps distinguish it from similar status codes and implement correct error handling. The response should include a descriptive body following a consistent error schema (like RFC 7807 Problem Details) so clients can programmatically handle the error.
// Handle 415 Unsupported Media Type in Express
app.use((err, req, res, next) => {
if (err.status === 415) {
return res.status(415).json({
type: 'https://api.example.com/errors/unsupported-media-type',
title: 'Unsupported Media Type',
status: 415,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 415 Unsupported Media Type
raise HTTPException(
status_code=415,
detail={
'type': 'unsupported_media_type',
'message': 'Descriptive error for 415 Unsupported Media Type'
}
)// Spring Boot 415 Unsupported Media Type handling
@ExceptionHandler(CustomUnsupportedMediaTypeException.class)
public ResponseEntity<ErrorResponse> handleUnsupportedMediaType(
CustomUnsupportedMediaTypeException ex) {
return ResponseEntity.status(415)
.body(new ErrorResponse("Unsupported Media Type", ex.getMessage()));
}// Return 415 Unsupported Media Type
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(415)
json.NewEncoder(w).Encode(map[string]any{
"status": 415,
"error": "Unsupported Media Type",
"message": message,
})
}