title: How to add custom header and bearer token for HttpRequest in Mock Test for Azure Function
body: <p>I am writing Unit Test for Function App which accept HttpRequest and run the secured api call with query parameters and some custom Headers and Bearer Token. I able to pass the query to request But how to add Headers is not working.</p>
  
  <p>I have tried the following code, edited my code as per suggestion of @Nkosi    </p>
  
  <pre><code>var postParam = new Dictionary&lt;string, StringValues&gt;();
  postParam.Add("param1", "123");
  request.Query = new QueryCollection(postParam);
  
  var headers = new HttpClient().DefaultRequestHeaders;
  headers.Add("Transaction", "1234");
  var request = Mock.Of&lt;HttpRequest&gt;(_ =&gt;
              _.Query == query &amp;&amp; _.Headers == headers //&lt;-- setup desired members
          );
  var logger = Mock.Of&lt;ILogger&gt;();
  
  var response = azureFunction.Run(request, logger);
  </code></pre>
  
  <p>Calling the following function</p>
  
  <pre><code>public static HttpResponseMessage Run(
          [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
          ILogger log){
  }
  </code></pre>
  
  <p>I am getting error here operater == can not be applied to IHeaderDictionary and HttpRequestHeaders</p>
  
  <pre><code>&amp;&amp; _.Headers == headers
  </code></pre>