Skip to content

Commit a0e652e

Browse files
committed
Emit antiforgery also when render modes are configured
1 parent 22aeaa0 commit a0e652e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Buffers;
55
using System.Diagnostics;
6+
using System.Net.Http;
67
using System.Text;
78
using System.Text.Encodings.Web;
89
using Microsoft.AspNetCore.Antiforgery;
@@ -142,7 +143,7 @@ await _renderer.InitializeStandardComponentServicesAsync(
142143

143144
context.Response.Headers.ContentEncoding = "identity";
144145
}
145-
else
146+
else if (endpoint.Metadata.GetMetadata<ConfiguredRenderModesMetadata>()?.ConfiguredRenderModes.Length == 0)
146147
{
147148
// Disable token generation on EndpointAntiforgeryStateProvider if we are not streaming.
148149
var provider = (EndpointAntiforgeryStateProvider)context.RequestServices.GetRequiredService<AntiforgeryStateProvider>();

0 commit comments

Comments
 (0)