title: Content Length header is not present in Http response with Azure function v1
body: <p>We have azure function which is running with azure v1 (.NET Framework 4.7). In http response, we are trying to set the content length but it is not flowing to client. It sets the Transfer encoding header with value as chunked.
  To give glimpse of how we are setting it.</p>
  
  <pre><code>var body = &lt;some byte array data&gt;
  var response = new HttpResponseMessage();
  response.Content = new ByteArrayContent(body);
  response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
  response.Content.Headers.ContentLength = body.Length;
  </code></pre>
  
  <p>I went through some <a href="https://social.msdn.microsoft.com/Forums/azure/en-US/7ceb818f-5e8c-42ff-b2ec-c0aa3f9094a2/app-service-suddenlt-started-to-respond-with-chunked-encoding-where-it-used-to-response-with?forum=windowsazurewebsitespreview" rel="nofollow noreferrer">online discussion</a> and <a href="https://github.com/Azure/azure-functions-host/issues/3765" rel="nofollow noreferrer">Azure/azure-functions-host#3765</a>
  There they talked about setting up,</p>
  
  <pre><code>response.Headers.TransferEncoding.Add(TransferCodingHeaderValue.Parse("identity"))
  </code></pre>
  
  <p>But it seems to be of no use.
  Would anyone faced such kind of issue before?
  BTW, when I ran the same code on azure function v2 (.NET Core 2.2) it works.</p>
  
  <p>Update: Transfer-Encoding header we could see through packet capture using wireshark.
  <a href="https://i.stack.imgur.com/JE36d.png" rel="nofollow noreferrer">Wireshark screenshot depicting Transfer-Encoding header even if content-length is set through code </a></p>
  
  <p>Update-2 : This is happening for function running locally. When we publish the function on azure it does provide the content length header. Locally, I guess it (v1) uses nodejs simulator which seems to have some issue. Anyway, will update here once we find out any workaround. </p>