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); }
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)); }