title: Misused header name. ... response headers with HttpResponseMessage, and content headers with HttpContent objects
body: <p>I'm working with an API with a web hook. i need to send back a 401 to trigger the proper logic. But my code is giving the error:</p>
  
  <pre><code> Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.
  </code></pre>
  
  <p>This is my code to send a 401 response:</p>
  
  <pre><code> HttpResponseMessage response = new HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized);
   response.Content = new StreamContent(new MemoryStream(),327);
   response.Content.Headers.Add("WWW-Authenticate", "Basic realm=\"myCloud\"" );
   response.Content.Headers.Add("Content-Type", "application/xml");
   return response;
  </code></pre>
  
  <p>What is the issue with the headers? The error implies that the headers are not intended for a HTTP Response, but a Request. But I don't get it since this is how the other API is designed to work -- it expects a 401 RESPONSE with the www-authenticate header.</p>
  
  <p>This is being returned from an Azure HTTP triggered Function (over HTTPS) (if that makes any difference). I'm trying to understand if I can ignore the error or if I am breaking some HTTP rules here?.</p>