public static void SetContentType(this IHeaderDictionary responseHeaders, IHeaderDictionary requestHeaders, ILogger logger, MediaTypeVersion version = MediaTypeVersion.V2)
        {
            var headers          = new RequestHeaders(requestHeaders);
            var acceptMediaTypes = headers.Accept?.Select(x => x.MediaType.Value).ToList();

            var contentType = ActuatorMediaTypes.GetContentHeaders(acceptMediaTypes, version);

            responseHeaders.Add("Content-Type", contentType);

            logger?.LogContentType(requestHeaders, contentType);
        }
        public static void SetContentType(this IHeaderDictionary responseHeaders, IHeaderDictionary requestHeaders, ILogger logger, MediaTypeVersion version = MediaTypeVersion.V2)
        {
            var acceptMediaTypes = new List <string>();

            if (requestHeaders.TryGetValue("Accept", out var acceptHeader))
            {
                acceptMediaTypes = acceptHeader.ToString().Split(';').ToList();
            }

            var contentType = ActuatorMediaTypes.GetContentHeaders(acceptMediaTypes, version);

            responseHeaders.Add("Content-Type", contentType);

            logger?.LogContentType(requestHeaders, contentType);
        }