diff options
| author | Patrick Barron <barronpm@gmail.com> | 2023-01-13 22:23:22 -0500 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2023-01-15 15:46:50 -0500 |
| commit | 7186b343bd21fe6b4e771b8530bd780a98a84472 (patch) | |
| tree | 2d163788f83006d2480b2418045b9c640b71fef8 /Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs | |
| parent | 74a07f6d1c52533aa648da27cb3924d6bb41bb19 (diff) | |
Move Formatters to Jellyfin.Api
Diffstat (limited to 'Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs')
| -rw-r--r-- | Jellyfin.Api/Formatters/PascalCaseJsonProfileFormatter.cs | 24 |
1 files changed, 24 insertions, 0 deletions
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 +{ + /// <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(JsonDefaults.PascalCaseOptions) + { + SupportedMediaTypes.Clear(); + // Add application/json for default formatter + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json)); + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.PascalCaseMediaType)); + } + } +} |
