How to check request content type in ASP.Net Web API?

asp.net-web-api

Solution

There's a context on every controller: http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.httpcontext.aspx

So you should be able to call `HttpContext.Request.ContentType`.

Problem

I have trouble finding the way to check request content type in ASP.NET Web Api. Is there a way I can check request content type whether it is application/xml or application/json at controller level? any help would be appreciated.

Original source