示例#1
0
        public static string GetHttpHeaderValue(this System.Net.Http.Headers.HttpHeaders headers, string name)
        {
            if (headers != null && headers.TryGetValues(name, out var values) && values != null)
            {
                return(string.Join("", values));
            }

            return(null);
        }
示例#2
0
        private bool MatchesHeader(KeyValuePair <string, string> matchHeader, System.Net.Http.Headers.HttpHeaders messageHeader)
        {
            if (messageHeader == null)
            {
                return(false);
            }

            IEnumerable <string> values;

            if (!messageHeader.TryGetValues(matchHeader.Key, out values))
            {
                return(false);
            }

            return(values.Any(v => v == matchHeader.Value));
        }