JsonEndpoint.cs 368 B

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