File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/Microsoft.AspNetCore.SpaServices/Webpack Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
1616 /// </summary>
1717 internal class ConditionalProxyMiddleware
1818 {
19+ private const int BUFFER_SIZE = 1024 ;
1920 private readonly HttpClient _httpClient ;
2021 private readonly RequestDelegate _next ;
2122 private readonly ConditionalProxyMiddlewareOptions _options ;
@@ -93,7 +94,12 @@ private async Task<bool> PerformProxyRequest(HttpContext context)
9394
9495 // SendAsync removes chunking from the response. This removes the header so it doesn't expect a chunked response.
9596 context . Response . Headers . Remove ( "transfer-encoding" ) ;
96- await responseMessage . Content . CopyToAsync ( context . Response . Body ) ;
97+
98+ using ( var responseStream = await responseMessage . Content . ReadAsStreamAsync ( ) )
99+ {
100+ await responseStream . CopyToAsync ( context . Response . Body , BUFFER_SIZE , context . RequestAborted ) ;
101+ }
102+
97103 return true ;
98104 }
99105 }
You can’t perform that action at this time.
0 commit comments