From 7186b343bd21fe6b4e771b8530bd780a98a84472 Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Fri, 13 Jan 2023 22:23:22 -0500 Subject: Move Formatters to Jellyfin.Api --- .../Formatters/PascalCaseJsonProfileFormatter.cs | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs (limited to 'Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs') diff --git a/Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs b/Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs new file mode 100644 index 000000000..5d77dbf4c --- /dev/null +++ b/Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs @@ -0,0 +1,24 @@ +using System.Net.Mime; +using Jellyfin.Extensions.Json; +using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Net.Http.Headers; + +namespace Jellyfin.Api.Formatters +{ + /// + /// Pascal Case Json Profile Formatter. + /// + public class PascalCaseJsonProfileFormatter : SystemTextJsonOutputFormatter + { + /// + /// Initializes a new instance of the class. + /// + public PascalCaseJsonProfileFormatter() : base(JsonDefaults.PascalCaseOptions) + { + SupportedMediaTypes.Clear(); + // Add application/json for default formatter + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json)); + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.PascalCaseMediaType)); + } + } +} -- cgit v1.2.3