diff --git a/src/TypedSignalR.Client.DevTools.Specification/Templates/CoreTemplate.cs b/src/TypedSignalR.Client.DevTools.Specification/Templates/CoreTemplate.cs index f6a64b1..8552790 100644 --- a/src/TypedSignalR.Client.DevTools.Specification/Templates/CoreTemplate.cs +++ b/src/TypedSignalR.Client.DevTools.Specification/Templates/CoreTemplate.cs @@ -24,17 +24,17 @@ internal static partial class EndpointRouteBuilderExtensions public static void UseSignalRHubSpecification(this IEndpointRouteBuilder endpointRouteBuilder) { // Actually, it does not use middleware. - endpointRouteBuilder.MapGet(""/signalr-dev/spec.json"", (HttpContext context) => + endpointRouteBuilder.MapGet(""/signalr-dev/spec.json"", async (HttpContext context) => { context.Response.StatusCode = StatusCodes.Status200OK; context.Response.ContentType = ""application/json""; - context.Response.BodyWriter.Write(GetSpecJsonBytes()); - context.Response.BodyWriter.Complete(); + var jsonBytes = GetSpecJsonBytes(); + await context.Response.Body.WriteAsync(jsonBytes); }); } - private static partial ReadOnlySpan GetSpecJsonBytes(); + private static partial ReadOnlyMemory GetSpecJsonBytes(); } "; } diff --git a/src/TypedSignalR.Client.DevTools.Specification/Templates/SpecificationTemplate.cs b/src/TypedSignalR.Client.DevTools.Specification/Templates/SpecificationTemplate.cs index be77edc..4d0fddc 100644 --- a/src/TypedSignalR.Client.DevTools.Specification/Templates/SpecificationTemplate.cs +++ b/src/TypedSignalR.Client.DevTools.Specification/Templates/SpecificationTemplate.cs @@ -49,7 +49,7 @@ namespace TypedSignalR.Client.DevTools; internal static partial class EndpointRouteBuilderExtensions {{ - private static partial ReadOnlySpan GetSpecJsonBytes() => new byte[] {{ {str} }}; + private static partial ReadOnlyMemory GetSpecJsonBytes() => new byte[] {{ {str} }}; }}"; } }