According to the RFC 7231, section 5.3.2:
The "Accept" header field can be used by user agents to specify response media types that are acceptable.
However, when requesting the JSON-HOME resource and setting the Accept: application/json-home header , the server returns a 404 error because it does not process well the header.
But when using the Content-Type: application/json-home header, the server correctly returns the JSON-HOME resource with the correct content type.
In the RFC 7231, section 3.1.1.5:
The "Content-Type" header field indicates the media type of the associated representation…
Where the "representation" is the payload of the message (request or response).
So the Content-Type header should not be used in the request to specify the server about the media type to return. The Accept header should be used instead.
According to the RFC 7231, section 5.3.2:
However, when requesting the JSON-HOME resource and setting the
Accept: application/json-homeheader , the server returns a404error because it does not process well the header.But when using the
Content-Type: application/json-homeheader, the server correctly returns the JSON-HOME resource with the correct content type.In the RFC 7231, section 3.1.1.5:
Where the "representation" is the payload of the message (request or response).
So the
Content-Typeheader should not be used in the request to specify the server about the media type to return. TheAcceptheader should be used instead.