title: How to change the http status code after starting writing to the HttpContext.Response.Body stream in ASP.NET Core?
body: <p>I often see that writing to the <code>HttpContext.Response.Body</code> stream is a bad practice (or using <code>PushStreamContent</code> or <code>StreamContent</code> as part of a HttpMessageResponse) cause then you cannot change the HTTP status code if there is something wrong happening.</p>
  
  <p>Is there any workaround to actually perform <code>async</code> writing to the output stream while being able to change HTTP status code in case the operation goes wrong?</p>