The Free Software Media System - Server Backend & API
Move json profiles to constant strings.
crobibero1d3303fa0a4a
diff --git a/Jellyfin.Api/BaseJellyfinApiController.cs b/Jellyfin.Api/BaseJellyfinApiController.csindex 6288fb7e34..1c1fc71d79 100644--- a/Jellyfin.Api/BaseJellyfinApiController.cs+++ b/Jellyfin.Api/BaseJellyfinApiController.cs@@ -1,4 +1,5 @@using System.Net.Mime;+using MediaBrowser.Common.Json;using Microsoft.AspNetCore.Mvc;namespace Jellyfin.Api@@ -10,8 +11,8 @@ namespace Jellyfin.Api[Route("[controller]")][Produces(MediaTypeNames.Application.Json,- MediaTypeNames.Application.Json + "; profile=\"CamelCase\"",- MediaTypeNames.Application.Json + "; profile=\"PascalCase\"")]+ JsonDefaults.CamelCaseMediaType,+ JsonDefaults.PascalCaseMediaType)]public class BaseJellyfinApiController : ControllerBase{}diff --git a/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs b/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.csindex cac89416eb..8043989b1e 100644--- a/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs+++ b/Jellyfin.Server/Formatters/CamelCaseJsonProfileFormatter.cs@@ -15,7 +15,7 @@ namespace Jellyfin.Server.Formatterspublic CamelCaseJsonProfileFormatter() : base(JsonDefaults.GetCamelCaseOptions()){SupportedMediaTypes.Clear();- SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json; profile=\"CamelCase\""));+ SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.CamelCaseMediaType));}}}diff --git a/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs b/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.csindex 2ba2241561..d0110b125c 100644--- a/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs+++ b/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs@@ -18,7 +18,7 @@ namespace Jellyfin.Server.FormattersSupportedMediaTypes.Clear();// Add application/json for default formatterSupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json));- SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json; profile=\"PascalCase\""));+ SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.PascalCaseMediaType));}}}diff --git a/MediaBrowser.Common/Json/JsonDefaults.cs b/MediaBrowser.Common/Json/JsonDefaults.csindex 5867cd4a0c..67f7e8f14a 100644--- a/MediaBrowser.Common/Json/JsonDefaults.cs+++ b/MediaBrowser.Common/Json/JsonDefaults.cs@@ -9,6 +9,16 @@ namespace MediaBrowser.Common.Json/// </summary>public static class JsonDefaults{+ /// <summary>+ /// Pascal case json profile media type.+ /// </summary>+ public const string PascalCaseMediaType = "application/json; profile=\"PascalCase\"";++ /// <summary>+ /// Camel case json profile media type.+ /// </summary>+ public const string CamelCaseMediaType = "application/json; profile=\"CamelCase\"";+/// <summary>/// Gets the default <see cref="JsonSerializerOptions" /> options./// </summary>