mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 05:57:20 -04:00
Move json profiles to constant strings.
This commit is contained in:
parent
a523ff840c
commit
1d3303fa0a
4 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
{
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Jellyfin.Server.Formatters
|
|||
public CamelCaseJsonProfileFormatter() : base(JsonDefaults.GetCamelCaseOptions())
|
||||
{
|
||||
SupportedMediaTypes.Clear();
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json; profile=\"CamelCase\""));
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.CamelCaseMediaType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Jellyfin.Server.Formatters
|
|||
SupportedMediaTypes.Clear();
|
||||
// Add application/json for default formatter
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json));
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json; profile=\"PascalCase\""));
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.PascalCaseMediaType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue