Ejemplo n.º 1
0
        public static bool HasHeaders(this HttpRequestMessage request)
        {
            // Note: The field name is _headers in .NET core
            string             headersFieldName = RuntimeUtils.IsDotNetFramework() ? "headers" : "_headers";
            FieldInfo          headersField     = typeof(HttpRequestMessage).GetField(headersFieldName, BindingFlags.Instance | BindingFlags.NonPublic);
            HttpRequestHeaders headers          = (HttpRequestHeaders)headersField.GetValue(request);

            return(headers != null);
        }