(HttpContext httpContext)
| 18 | } |
| 19 | |
| 20 | public override GeoLocation GetClientLocation(HttpContext httpContext) |
| 21 | { |
| 22 | var countryCode = GetHeader(httpContext, "cdn-requestcountrycode", "CloudFront-Viewer-Country", "CF-IPCountry"); |
| 23 | var regionCode = GetHeader(httpContext, "cdn-requeststatecode", "Cloudfront-Viewer-Country-Region"); |
| 24 | var regionName = _regions.TryGetValue($"{countryCode}-{regionCode}", out var name) ? name : ""; |
| 25 | |
| 26 | return new GeoLocation |
| 27 | { |
| 28 | CountryCode = countryCode ?? "", |
| 29 | RegionName = regionName ?? "" |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | private static string GetHeader(HttpContext httpContext, params string[] names) |
| 34 | { |
nothing calls this directly
no outgoing calls
no test coverage detected