title: Validate content type with WCF API
body: <p>I'm trying to validate that a request is either json or xml data for our api. I know I can do something along the lines of</p>
  
  <pre><code>if (!( request.ContentType.Equals("text/json", StringComparison.InvariantCultureIgnoreCase) || request.ContentType.Equals("text/xml", StringComparison.InvariantCultureIgnoreCase)))
      //throw error here
  </code></pre>
  
  <p>But, I'm wondering if there is a better way to do this. I read up about Content Management but everything I'm finding seems to be for web api.</p>
  
  <p>To give you an example of why I don't like this approach, one of our clients passes in text/xml; charset=UTF-8 and another passes in text / xml
  I can build checks for all of those but I was wondering if .net had anything built out there for this. I don't want to have to be hard coding something new, every new a new scenario comes up. </p>