clean up output formatters
This commit is contained in:
parent
634ee2d1e9
commit
2ca8d31b20
|
@ -8,7 +8,10 @@ namespace Jellyfin.Api
|
|||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
[Produces(MediaTypeNames.Application.Json)]
|
||||
[Produces(
|
||||
MediaTypeNames.Application.Json,
|
||||
MediaTypeNames.Application.Json + "; profile=\"CamelCase\"",
|
||||
MediaTypeNames.Application.Json + "; profile=\"PascalCase\"")]
|
||||
public class BaseJellyfinApiController : ControllerBase
|
||||
{
|
||||
}
|
||||
|
|
|
@ -150,6 +150,10 @@ namespace Jellyfin.Server.Extensions
|
|||
.AddMvc(opts =>
|
||||
{
|
||||
opts.UseGeneralRoutePrefix(baseUrl);
|
||||
|
||||
// Allow requester to change between camelCase and PascalCase
|
||||
opts.RespectBrowserAcceptHeader = true;
|
||||
|
||||
opts.OutputFormatters.Insert(0, new CamelCaseJsonProfileFormatter());
|
||||
opts.OutputFormatters.Insert(0, new PascalCaseJsonProfileFormatter());
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Net.Mime;
|
||||
using MediaBrowser.Common.Json;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
@ -16,7 +17,7 @@ namespace Jellyfin.Server.Formatters
|
|||
{
|
||||
SupportedMediaTypes.Clear();
|
||||
// Add application/json for default formatter
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json"));
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json));
|
||||
SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json; profile=\"PascalCase\""));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ namespace Jellyfin.Server.Formatters
|
|||
/// </summary>
|
||||
public XmlOutputFormatter()
|
||||
{
|
||||
SupportedMediaTypes.Clear();
|
||||
SupportedMediaTypes.Add(MediaTypeNames.Text.Xml);
|
||||
SupportedMediaTypes.Add("text/xml;charset=UTF-8");
|
||||
|
||||
SupportedEncodings.Add(Encoding.UTF8);
|
||||
SupportedEncodings.Add(Encoding.Unicode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user