AES Encryption Explained: How It Works and Why It Matters
Jun 23, 2026
4xx Client Error
The 415 (Unsupported Media Type) status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by the target resource. The client should check the Content-Type header it sent and ensure it matches one of the formats the server accepts.
When your API only accepts JSON payloads, validate the Content-Type header on every request. If a client sends Content-Type: application/xml, return 415 Unsupported Media Type with a message indicating that only application/json is accepted.
// Laravel - validating Content-Type
if ($request->header('Content-Type') !== 'application/json') {
return response()->json([
'error' => 'Unsupported Media Type',
'supported' => ['application/json'],
], 415);
}
Mistake: Returning 400 instead of 415 for wrong Content-Type
Fix: Use 415 specifically when the Content-Type is not supported. It is more descriptive than the generic 400 and tells the client exactly what the issue is.
Blog
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026
Jun 23, 2026