You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Extensions.cs 493 B

1234567891011121314151617181920
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using Microsoft.AspNetCore.Http;
  5. namespace MQTTnet.Server.Web
  6. {
  7. public static class Extensions
  8. {
  9. public static string ReadBodyAsString(this HttpRequest request)
  10. {
  11. if (request == null) throw new ArgumentNullException(nameof(request));
  12. using (var reader = new StreamReader(request.Body, Encoding.UTF8))
  13. {
  14. return reader.ReadToEnd();
  15. }
  16. }
  17. }
  18. }