File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
StandardSocketsHttpHandler Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,10 @@ internal static class HttpRequestMessageExtensions
88 {
99 public static bool HasHeaders ( this HttpRequestMessage request )
1010 {
11- // Note: The field name is _headers in .NET core
11+ // Note: The field name is _headers in .NET core, and headers in .NET Mono / .NET Framework
1212 bool isDotNetFramework = RuntimeUtils . IsDotNetFramework ( ) ;
13- string headersFieldName = isDotNetFramework ? "headers" : "_headers" ;
13+ bool isMono = RuntimeUtils . IsMono ( ) ;
14+ string headersFieldName = isDotNetFramework || isMono ? "headers" : "_headers" ;
1415 FieldInfo headersField = typeof ( HttpRequestMessage ) . GetField ( headersFieldName , BindingFlags . Instance | BindingFlags . NonPublic ) ;
1516 if ( headersField == null && isDotNetFramework )
1617 {
Original file line number Diff line number Diff line change @@ -18,5 +18,12 @@ public static bool IsDotNetNative()
1818 string frameworkDescription = RuntimeInformation . FrameworkDescription ;
1919 return frameworkDescription . StartsWith ( DotnetFrameworkDescription ) ;
2020 }
21+
22+ public static bool IsMono ( )
23+ {
24+ const string MonoDescription = "Mono" ;
25+ string frameworkDescription = RuntimeInformation . FrameworkDescription ;
26+ return frameworkDescription . StartsWith ( MonoDescription ) ;
27+ }
2128 }
2229}
You can’t perform that action at this time.
0 commit comments