mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-24 14:40:39 +02:00
Fix PascalCase
This commit is contained in:
parent
ad67081840
commit
c89dc8921f
|
@ -4,6 +4,7 @@ using Jellyfin.Api.Auth.FirstTimeSetupOrElevatedPolicy;
|
||||||
using Jellyfin.Api.Auth.RequiresElevationPolicy;
|
using Jellyfin.Api.Auth.RequiresElevationPolicy;
|
||||||
using Jellyfin.Api.Constants;
|
using Jellyfin.Api.Constants;
|
||||||
using Jellyfin.Api.Controllers;
|
using Jellyfin.Api.Controllers;
|
||||||
|
using Jellyfin.Server.Formatters;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
@ -66,6 +67,8 @@ namespace Jellyfin.Server.Extensions
|
||||||
return serviceCollection.AddMvc(opts =>
|
return serviceCollection.AddMvc(opts =>
|
||||||
{
|
{
|
||||||
opts.UseGeneralRoutePrefix(baseUrl);
|
opts.UseGeneralRoutePrefix(baseUrl);
|
||||||
|
opts.OutputFormatters.Insert(0, new CamelCaseJsonProfileFormatter());
|
||||||
|
opts.OutputFormatters.Insert(0, new PascalCaseJsonProfileFormatter());
|
||||||
})
|
})
|
||||||
|
|
||||||
// Clear app parts to avoid other assemblies being picked up
|
// Clear app parts to avoid other assemblies being picked up
|
||||||
|
|
23
Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs
Normal file
23
Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||||
|
using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Formatters
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Pascal Case Json Profile Formatter.
|
||||||
|
/// </summary>
|
||||||
|
public class PascalCaseJsonProfileFormatter : SystemTextJsonOutputFormatter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="PascalCaseJsonProfileFormatter"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public PascalCaseJsonProfileFormatter() : base(new JsonSerializerOptions { PropertyNamingPolicy = null })
|
||||||
|
{
|
||||||
|
SupportedMediaTypes.Clear();
|
||||||
|
// Add application/json for default formatter
|
||||||
|
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
|
||||||
|
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"PascalCase\""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue