您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }