title: Headers disappearing when using HttpSelfHostServer
body: <p>I'm in the process of migrating a rather extensive REST service from WCF to ASP.NET WebAPI. We are using the Authorization header to send tokens from client to the server, and I implemented a DelegateHandler with code that responds with a 401 as soon as it sees there is no valid Authorization header. A simplification of the code can be seen here:</p>
  
  <pre><code>public class AuthenticationHandler : DelegatingHandler
  {
      protected override Task&lt;HttpResponseMessage&gt; SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          if (request == null) throw new ArgumentNullException("request");
          return !IsClientAuthorized(request)
              ? Task&lt;HttpResponseMessage&gt;.Factory.StartNew(() =&gt; new HttpResponseMessage(HttpStatusCode.Unauthorized))
              : base.SendAsync(request, cancellationToken);
      }
  
      private bool IsClientAuthorized(HttpRequestMessage request)
      {
          return request != null &amp;&amp; !string.IsNullOrEmpty(request.Headers.Authorization.ToString());
      }
  }
  </code></pre>
  
  <p>It works fine when hosted in IIS, but for integration tests I am using HttpSelfHostServer, and here the Authorization header is not present on the HttpRequestMessage, even though I can see it was sent on the Fiddler trace. </p>
  
  <p>I tried to make a really simple WebAPI application using self hosting to verify that the problem is consistent, but unfortunately it works as expected there. So it must be related to my code somehow, but I am completely blank to what is causing it.</p>
  
  <p>Has anyone else seen this behavior, or does anyone have suggestions for how to trace where in the WebAPI stack it goes wrong?</p>