public IHttpContentEncoding MatchFor(string acceptEncoding) { var acceptableValues = acceptEncoding .Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim()); IHttpContentEncoding encoding = new PassthroughEncoding(); foreach(var value in acceptableValues) { var matching = _encodings.FirstOrDefault(x => x.MatchingEncoding.Matches(value)); if (matching == null) continue; encoding = matching; break; } return encoding; }
public IHttpContentEncoding MatchFor(string acceptEncoding) { var acceptableValues = acceptEncoding .Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries) .Select(x => x.Trim()); IHttpContentEncoding encoding = new PassthroughEncoding(); foreach (var value in acceptableValues) { var matching = _encodings.FirstOrDefault(x => x.MatchingEncoding.Matches(value)); if (matching == null) { continue; } encoding = matching; break; } return(encoding); }