This project is read-only.
3
Vote

How to handle Content Negotiation Failures

description

A client can tell the server that he can only understand some specific message format in HTTP with following header info:

REQUEST

Accept: application/vnd.customer+xml,/;q=0.0

If the server does not support this media type, he should return a HTTP 406 Status Code (Not Acceptable) with an optional help URI:

RESPONSE

406 Not Acceptable
Content-Type: application/xml
Link: http://www.myservices.com/errors/supported_mediattypes.html;rel="help"
...

But the Web API returns XML by default. It should be returning a 406 by default...

See also: RESTful Web Services Cookbook by Subbu Allamaraju, O´Reiily, Page 132

comments