You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/blazor/call-web-api.md
+33-8Lines changed: 33 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -353,6 +353,37 @@ You can address this by flowing prerendered state using the Persistent Component
353
353
354
354
:::moniker-end
355
355
356
+
:::moniker range=">= aspnetcore-9.0"
357
+
358
+
## Client-side request streaming
359
+
360
+
For Chromium-based browsers (for example, Google Chrome and Microsoft Edge) using the HTTP/2 protocol, and HTTPS, client-side Blazor uses [Streams API](https://developer.mozilla.org/docs/Web/API/Streams_API) to permit [request streaming](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests).
361
+
362
+
To enable request streaming, set <xref:Microsoft.AspNetCore.Components.WebAssembly.Http.WebAssemblyHttpRequestMessageExtensions.SetBrowserRequestStreamingEnabled%2A> to `true` on the <xref:System.Net.Http.HttpRequestMessage>.
363
+
364
+
In the following file upload example:
365
+
366
+
*`content` is the file's <xref:System.Net.Http.HttpContent>.
* Require HTTPS protocol and don't work on HTTP/1.x.
381
+
* Include a body but not a `Content-Length` header. [CORS](xref:security/cors) with a preflight request is required for cross-origin streaming requests.
382
+
383
+
For more information on file uploads with an <xref:Microsoft.AspNetCore.Components.Forms.InputFile> component, see <xref:blazor/file-uploads#file-size-read-and-upload-limits> and the example at [Upload files to a server with client-side rendering (CSR)](xref:blazor/file-uploads#upload-files-to-a-server-with-client-side-rendering-csr).
384
+
385
+
:::moniker-end
386
+
356
387
## Add the `HttpClient` service
357
388
358
389
*The guidance in this section applies to client-side scenarios.*
@@ -368,10 +399,7 @@ In the `Program` file, add an <xref:System.Net.Http.HttpClient> service if it is
The preceding example sets the base address with `builder.HostEnvironment.BaseAddress` (<xref:Microsoft.AspNetCore.Components.WebAssembly.Hosting.IWebAssemblyHostEnvironment.BaseAddress%2A?displayProperty=nameWithType>), which gets the base address for the app and is typically derived from the `<base>` tag's `href` value in the host page.
@@ -385,10 +413,7 @@ If you're calling an external web API (not in the same URL space as the client a
0 commit comments