I noticed when consuming my simple resource (listed below) that i am able to get the Accept header by referencing “WebOperationContext.Current.IncomingRequest.Accept” although to conform to a specification I need to iterate over all the provided Accept headers names, although it appears WCF only returns the first one it finds.
[WebGet(UriTemplate = "system", ResponseFormat = WebMessageFormat.Json)]
If i put all of the header name values into one string and separate by commas, it works. But that’s not the issue I’m talking about here.
I would say that it is what it is, although http://www.faqs.org/rfcs/rfc2616.html section 4.2 indicates that multiple header names are permitted as long as their values can be joined by a comma and still be proper syntax (which it can be).
So it’s funny to me that this would not be supported. Am I missing something?
I haven’t tested this at all, but have you tried
WebOperationContext.Current.IncomingRequest.Headers["Accept"]?I know that if you call WebHeaderCollection.Add multiple times for the same header it will concatenate them with commas where appropriate. But in theory it could be that the IncomingWebRequestContext stores the first Accept header separately, since it is just a convenience property and may only work with the common case of only one Accept header.