title: How to stream with ASP.NET Core
body: <p>How to properly stream response in ASP.NET Core? 
  There is a controller like this (<strong>UPDATED CODE</strong>):</p>
  
  <pre><code>[HttpGet("test")]
  public async Task GetTest()
  {
      HttpContext.Response.ContentType = "text/plain";
      using (var writer = new StreamWriter(HttpContext.Response.Body))
          await writer.WriteLineAsync("Hello World");            
  }
  </code></pre>
  
  <p>Firefox/Edge browsers show </p>
  
  <blockquote>
    <p>Hello World</p>
  </blockquote>
  
  <p>, while Chrome/Postman report an error:</p>
  
  <blockquote>
    <p>The localhost page isn’t working</p>
    
    <p>localhost unexpectedly closed the connection.</p>
    
    <p>ERR_INCOMPLETE_CHUNKED_ENCODING</p>
  </blockquote>
  
  <p>P.S. I am about to stream a lot of content, so I cannot specify Content-Length header in advance.</p>