Request Streaming will be part of .NET 9: dotnet/runtime#91295, dotnet/runtime#91699
This allows the usage of request streaming when supported. In addition to that it also needs to be opted in via:
request.Options.Set(BrowserHttpHandler.EnableStreamingRequest, true);
For streaming requests over HTTP 1 the following setting is also required:
request.SetBrowserRequestOption("allowHTTP1ForStreamingUpload", true);
Currently this feature Experimental Web Platform features
needs to be enabled in chrome://flags/
-
Index.razor: streaming inputs
-
Upload.razor: upload multipart form file
-
BrowserHttpHandler.cs: modified version of the dotnet/runtime code
- dotnet runtime issue: dotnet/runtime#36634
- Google Chrome feature status: https://www.chromestatus.com/feature/5274139738767360
- ReadableStream MDN: https://developer.mozilla.org/docs/Web/API/ReadableStream/ReadableStream
- web.dev article which the index example is based on: https://web.dev/fetch-upload-streaming/