title: How to read request body multiple times in asp net core 2.2 middleware?
body: <p>I tried this:
  <a href="https://stackoverflow.com/questions/31389781/read-request-body-twice">Read request body twice</a>
  and this:
  <a href="https://github.com/aspnet/Mvc/issues/4962" rel="noreferrer">https://github.com/aspnet/Mvc/issues/4962</a>
  but did not work.
  I read request body like this:</p>
  
  <pre><code>app.Use(async (context, next) =&gt;
  {
      var requestBody = await ReadStream(context.Request.Body);
      var requestPath = context.Request.Path.ToString();
      //Do some thing
  
      await next.Invoke();
  
      var responseStatusCode = context.Response.StatusCode;
      //Do some other thing
  });
  
  private async Task&lt;string&gt; ReadStream(Stream stream)
  {
      using (var streamReader = new StreamReader(stream))
      {
          var result = await streamReader.ReadToEndAsync();
  
          return result;
      }
  }
  </code></pre>
  
  <p>In controller I get 'disposed object' or 'empty stream'.</p>