Fix ClearsResponseBuffer_BeforeRequestIsReexecuted #24146 (#25294)

This commit is contained in:
Chris Ross 2020-08-31 10:20:05 -07:00 committed by GitHub
parent 2ea674021f
commit 1cf67b3faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -145,15 +145,14 @@ namespace Microsoft.AspNetCore.Diagnostics
try try
{ {
await next(); await next();
response.Body = originalResponseBody;
bufferingStream.Seek(0, SeekOrigin.Begin);
await bufferingStream.CopyToAsync(response.Body);
} }
finally finally
{ {
response.Body = originalResponseBody; response.Body = originalResponseBody;
} }
bufferingStream.Seek(0, SeekOrigin.Begin);
await bufferingStream.CopyToAsync(response.Body);
}); });
app.UseExceptionHandler("/handle-errors"); app.UseExceptionHandler("/handle-errors");