File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . Diagnostics . CodeAnalysis ;
34using System . Net . Http ;
45using System . Text ;
@@ -11,7 +12,10 @@ namespace WebApiClientCore
1112 /// </summary>
1213 public class ApiResponseContext : ApiRequestContext
1314 {
15+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1416 private object ? result ;
17+
18+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1519 private Exception ? exception ;
1620
1721 /// <summary>
Original file line number Diff line number Diff line change 11using System ;
2+ using System . Diagnostics ;
23using System . Text . Encodings . Web ;
34using System . Text . Json ;
45using System . Xml ;
@@ -11,10 +12,19 @@ namespace WebApiClientCore
1112 /// </summary>
1213 public class HttpApiOptions
1314 {
15+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1416 private JsonSerializerOptions ? jsonSerializeOptions ;
17+
18+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1519 private JsonSerializerOptions ? jsonDeserializeOptions ;
20+
21+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1622 private XmlWriterSettings ? xmlSerializeOptions ;
23+
24+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1725 private XmlReaderSettings ? xmlDeserializeOptions ;
26+
27+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1828 private KeyValueSerializerOptions ? keyValueSerializeOptions ;
1929
2030 /// <summary>
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
34using System . Text . Encodings . Web ;
45using System . Text . Json ;
56using System . Text . Json . Serialization ;
@@ -14,6 +15,7 @@ public sealed class KeyValueSerializerOptions : KeyNamingOptions
1415 /// <summary>
1516 /// 包装的jsonOptions
1617 /// </summary>
18+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
1719 private readonly JsonSerializerOptions jsonOptions ;
1820
1921 /// <summary>
Original file line number Diff line number Diff line change @@ -44,7 +44,11 @@ public static async Task<byte[]> ReadAsByteArrayAsync(this HttpContent httpConte
4444 public static Encoding GetEncoding ( this HttpContent httpContent )
4545 {
4646 var charSet = httpContent . Headers . ContentType ? . CharSet ;
47- return string . IsNullOrEmpty ( charSet ) ? Encoding . UTF8 : Encoding . GetEncoding ( charSet ) ;
47+ if ( string . IsNullOrEmpty ( charSet ) || charSet == Encoding . UTF8 . WebName )
48+ {
49+ return Encoding . UTF8 ;
50+ }
51+ return Encoding . GetEncoding ( charSet ) ;
4852 }
4953 }
5054}
You can’t perform that action at this time.
0 commit comments