private static ApiMode ExtractApiModeHeader(HttpHeaders headers) { if (headers == null) { throw new ArgumentNullException("headers"); } var apiMode = ApiMode.Production; if (!headers.Contains(ApiModeKey)) { return(apiMode); } var headerValue = headers.First(h => h.Key.Equals(ApiModeKey)).Value.First(); if (headerValue.Equals("demo", StringComparison.InvariantCultureIgnoreCase)) { apiMode = ApiMode.Demo; } return(apiMode); }
private static IList <string> GetHeaderValues(HttpHeaders headers, string name) { return(headers.First(h => h.Key == name).Value.ToList()); }