Fix HTTP 415 Unsupported Media Type
A 415 response means the server refuses the request body format. Compare the declared Content-Type with the bytes actually sent and the media types documented for that operation.
Separate Content-Type from Accept
Content-Type describes the request body. Accept describes response formats the client prefers. Setting only Accept: application/json does not tell the server that a request body is JSON. Inspect the final request in the browser Network panel or an HTTP trace rather than relying only on source code.
Send JSON as JSON
For JSON, serialize an object with the client’s JSON facility and send Content-Type: application/json. A JavaScript object passed directly as a body may become the string [object Object]; a form library may send URL-encoded data instead. Validate the exact text with the JSON Validator, then confirm the header survives proxies and redirects.
Let multipart clients create boundaries
A multipart content type requires a boundary parameter that also appears between body parts. Browser FormData and mature HTTP libraries generate both together. Manually setting Content-Type: multipart/form-data commonly omits or mismatches the boundary. Remove the manual header and let the client encode it unless the library explicitly documents another workflow.
Check form, text, XML, and vendor media types
Some endpoints accept application/x-www-form-urlencoded, plain text, XML, binary data, or a vendor type such as application/vnd.example+json. The same payload represented in another type is not interchangeable. Check the OpenAPI requestBody content map and verify that the deployed server matches it. Charset parameters are normally safe for text, but strict or outdated parsers may reject unexpected parameters.
Find middleware mismatches
Framework body parsers are often registered only for selected routes and types. A gateway can also enforce media types before the request reaches application code. Correlate gateway logs and application logs with a request ID. If the server returns 415 before the handler runs, fix routing or parser configuration at the layer making the decision.
Preserve a regression request
Keep a minimal request fixture containing the method, path, content type, and representative body. Test one accepted and one rejected media type. Do not log confidential bodies. Use cURL to Fetch to compare client semantics without executing the request in Cryonel.
Frequently Asked Questions
Is Accept the same as Content-Type?
No. One describes the desired response; the other describes the request body.
Should I set a multipart boundary manually?
Usually no. Let the client generate it with the body.
Can valid JSON still produce 415?
Yes, when its declared media type is missing or unsupported.