HTTP Accept header

Topics: ASP.NET Web API
May 15, 2012 at 3:14 PM

Hi,

Just a quick question on HTTP accept header. According to spec, Accept header can include extensions in the format of custom tokens:

accept-extension = ";" token [ "=" ( token | quoted-string ) ]

What is the best way to get these tokens? Currently HttpRequestHeaders.Accept is defined as  System.Net.Http.Headers.HttpHeaderValueCollection<MediaTypeWithQualityHeaderValue> which seems to ignore these custom extensions.

Do I have to go to to request.Headers["Accept"] and parse the value or there is alternative means (or the support will be up-coming)?

Thanks a lot

 

May 15, 2012 at 3:23 PM

You can get at the additional parameters from the Parameters property.


Henrik

May 15, 2012 at 3:39 PM

Thanks! Exactly what I was looking for.