HTTP

HTTP 415 Unsupported Media Type vs 417 Expectation Failed

Both HTTP 415 (Unsupported Media Type) and 417 (Expectation Failed) belong to the 4xx Client Error category. 415 indicates that the server refuses to accept the request because the Content-Type is not supported. Meanwhile, 417 means that the server cannot meet the requirements of the Expect header.

Description

The server refuses to accept the request because the Content-Type is not supported.

When You See It

When sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.

How to Fix

Set the correct Content-Type header matching the data format you're sending.

Description

The server cannot meet the requirements of the Expect header.

When You See It

When the server doesn't support Expect: 100-continue.

How to Fix

Remove the Expect header from your request.

Key Differences

1.

HTTP 415: The server refuses to accept the request because the Content-Type is not supported.

2.

HTTP 417: The server cannot meet the requirements of the Expect header.

3.

You encounter 415 when when sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.

4.

You encounter 417 when when the server doesn't support Expect: 100-continue.

When to Use Which

For 415 (Unsupported Media Type): Set the correct Content-Type header matching the data format you're sending. For 417 (Expectation Failed): Remove the Expect header from your request.

Learn More