using Microsoft.Extensions.Primitives; namespace DealerSelection.Common.Logging; public class HttpHeaderHelper { public static int? ExtractInt(string key, List> headers) { int? res = null; string? resString = Extract(key, headers); if (resString == null) { if(int.TryParse(resString, out int resTemp)) res = resTemp; } return res; } public static string? Extract(string key, List> headers) { string? res = null; KeyValuePair header = headers.FirstOrDefault(h=> h.Key == key); if (header.Value.Any()) res = header.Value.FirstOrDefault(); return res; } }