PlainTextEndpoint.cs 459 B

1234567891011121314151617
  1. namespace Benchmarks.Endpoints;
  2. public class PlainTextEndpoint : Endpoint<EmptyRequest, object>
  3. {
  4. private static readonly byte[] payload = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
  5. public override void Configure()
  6. {
  7. Get("/plaintext");
  8. AllowAnonymous();
  9. }
  10. public override Task HandleAsync(EmptyRequest r, CancellationToken ct)
  11. {
  12. return SendBytesAsync(payload, contentType: "text/plain");
  13. }
  14. }