PlaintextProvider.cs 560 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using GenHTTP.Api.Modules;
  6. using GenHTTP.Api.Protocol;
  7. namespace Benchmarks.Tests
  8. {
  9. public class PlaintextProvider : IContentProvider
  10. {
  11. private static readonly byte[] PAYLOAD = Encoding.ASCII.GetBytes("Hello, World!");
  12. public IResponseBuilder Handle(IRequest request)
  13. {
  14. return request.Respond()
  15. .Content(new MemoryStream(PAYLOAD), ContentType.TextPlain);
  16. }
  17. }
  18. }