This project is read-only.

HTTP Accept header

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


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 4:23 PM

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


May 15, 2012 at 4:39 PM

Thanks! Exactly what I was looking for.