|
@@ -173,11 +173,11 @@ namespace Extensions
|
|
|
/// <returns></returns>
|
|
|
public static string GetBody(this HttpContext context)
|
|
|
{
|
|
|
- // context.Request.EnableBuffering();
|
|
|
- //context.Request.Body.Seek(0, SeekOrigin.Begin);
|
|
|
- //using var reader = new StreamReader(context.Request.Body, Encoding.UTF8);
|
|
|
- ////需要使用异步方式才能获取
|
|
|
- //return reader.ReadToEndAsync().Result;
|
|
|
+ context.Request.EnableBuffering();
|
|
|
+ context.Request.Body.Seek(0, SeekOrigin.Begin);
|
|
|
+ using var reader = new StreamReader(context.Request.Body, Encoding.UTF8);
|
|
|
+ //需要使用异步方式才能获取
|
|
|
+ return reader.ReadToEndAsync().Result;
|
|
|
// string body = string.Empty;
|
|
|
// var buffer = new MemoryStream();
|
|
|
// context.Request.Body.Seek(0, SeekOrigin.Begin);
|
|
@@ -193,11 +193,11 @@ namespace Extensions
|
|
|
// buffer?.Dispose();
|
|
|
// }
|
|
|
// return body;
|
|
|
- var reader = new StreamReader(context.Request.Body, Encoding.UTF8);
|
|
|
- //需要使用异步方式才能获取
|
|
|
- string content = reader.ReadToEnd();
|
|
|
- reader.Dispose();
|
|
|
- return content;
|
|
|
+ // var reader = new StreamReader(context.Request.Body, Encoding.UTF8);
|
|
|
+ // //需要使用异步方式才能获取
|
|
|
+ // string content = reader.ReadToEnd();
|
|
|
+ // reader.Dispose();
|
|
|
+ // return content;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|