File tree 4 files changed +21
-1
lines changed
4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Diagnostics ;
2
3
using System . Diagnostics . CodeAnalysis ;
3
4
using System . Net . Http ;
4
5
using System . Text ;
@@ -11,7 +12,10 @@ namespace WebApiClientCore
11
12
/// </summary>
12
13
public class ApiResponseContext : ApiRequestContext
13
14
{
15
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
14
16
private object ? result ;
17
+
18
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
15
19
private Exception ? exception ;
16
20
17
21
/// <summary>
Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Diagnostics ;
2
3
using System . Text . Encodings . Web ;
3
4
using System . Text . Json ;
4
5
using System . Xml ;
@@ -11,10 +12,19 @@ namespace WebApiClientCore
11
12
/// </summary>
12
13
public class HttpApiOptions
13
14
{
15
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
14
16
private JsonSerializerOptions ? jsonSerializeOptions ;
17
+
18
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
15
19
private JsonSerializerOptions ? jsonDeserializeOptions ;
20
+
21
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
16
22
private XmlWriterSettings ? xmlSerializeOptions ;
23
+
24
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
17
25
private XmlReaderSettings ? xmlDeserializeOptions ;
26
+
27
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
18
28
private KeyValueSerializerOptions ? keyValueSerializeOptions ;
19
29
20
30
/// <summary>
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
+ using System . Diagnostics ;
3
4
using System . Text . Encodings . Web ;
4
5
using System . Text . Json ;
5
6
using System . Text . Json . Serialization ;
@@ -14,6 +15,7 @@ public sealed class KeyValueSerializerOptions : KeyNamingOptions
14
15
/// <summary>
15
16
/// 包装的jsonOptions
16
17
/// </summary>
18
+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
17
19
private readonly JsonSerializerOptions jsonOptions ;
18
20
19
21
/// <summary>
Original file line number Diff line number Diff line change @@ -44,7 +44,11 @@ public static async Task<byte[]> ReadAsByteArrayAsync(this HttpContent httpConte
44
44
public static Encoding GetEncoding ( this HttpContent httpContent )
45
45
{
46
46
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 ) ;
48
52
}
49
53
}
50
54
}
You can’t perform that action at this time.
0 commit comments