WCF REST list HTTP headers on incoming request
rest, wcf
Solution
Eventually found the answer.
using System.ServiceModel.Web;
protected override IEnumerable<KeyValuePair<string, SampleItem>> OnGetItems() {
WebHeaderCollection headers = WebOperationContext.Current.IncomingRequest.Headers;
foreach (string key in headers.Keys) {
logger.Debug("header " + key + "=" + headers[key]);
}
}
Problem
I've fired up the WCF REST starter kit and am trying to access the HTTP headers on the incoming request. I've looked at OperationContext.Current.IncomingMessageHeaders but either it doesn't hold them or I'm accessing it wrong. How do I list the HTTP headers?