File tree 1 file changed +7
-5
lines changed
WebApiClientCore/System.Net.Http 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
- using System . Reflection ;
1
+ using System . Diagnostics . CodeAnalysis ;
2
+ using System . Reflection ;
2
3
using System . Runtime . CompilerServices ;
3
4
using System . Text ;
4
5
using System . Threading ;
@@ -24,7 +25,8 @@ public static class HttpContentExtensions
24
25
25
26
/// <summary>
26
27
/// 静态构造器
27
- /// </summary>
28
+ /// </summary>
29
+ [ DynamicDependency ( DynamicallyAccessedMemberTypes . NonPublicProperties , typeof ( HttpContent ) ) ]
28
30
static HttpContentExtensions ( )
29
31
{
30
32
var property = typeof ( HttpContent ) . GetProperty ( IsBufferedPropertyName , BindingFlags . Instance | BindingFlags . NonPublic ) ;
@@ -70,8 +72,8 @@ public static void EnsureNotBuffered(this HttpContent httpContent)
70
72
{
71
73
throw new HttpContentBufferedException ( ) ;
72
74
}
73
- }
74
-
75
+ }
76
+
75
77
/// <summary>
76
78
/// 读取为二进制数组并转换为 utf8 编码
77
79
/// </summary>
@@ -133,7 +135,7 @@ public static Encoding GetEncoding(this HttpContent httpContent)
133
135
return encoding . Equals ( Encoding . UTF8 . WebName , StringComparison . OrdinalIgnoreCase )
134
136
? Encoding . UTF8
135
137
: Encoding . GetEncoding ( encoding . ToString ( ) ) ;
136
- }
138
+ }
137
139
138
140
}
139
141
}
You can’t perform that action at this time.
0 commit comments