JsonEndpoint.cs 393 B

12345678910111213141516
  1. namespace Benchmarks.Endpoints;
  2. public class JsonEndpoint : Endpoint<EmptyRequest, object>
  3. {
  4. public override void Configure()
  5. {
  6. Get("/json");
  7. AllowAnonymous();
  8. }
  9. public override Task HandleAsync(EmptyRequest _, CancellationToken __)
  10. {
  11. HttpContext.Response.ContentLength = 27;
  12. return SendAsync(new { message = "Hello, World!" });
  13. }
  14. }