mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Don't log OperationCanceledException every time an HMR client disconnects
This commit is contained in:
@@ -97,9 +97,17 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
|
||||
context.Response.Headers.Remove("transfer-encoding");
|
||||
|
||||
using (var responseStream = await responseMessage.Content.ReadAsStreamAsync())
|
||||
{
|
||||
try
|
||||
{
|
||||
await responseStream.CopyToAsync(context.Response.Body, DefaultHttpBufferSize, context.RequestAborted);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// The CopyToAsync task will be canceled if the client disconnects (e.g., user
|
||||
// closes or refreshes the browser tab). Don't treat this as an error.
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user