diff options
| author | crobibero <cody@robibe.ro> | 2020-05-24 12:33:16 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-05-24 12:33:16 -0600 |
| commit | 62ea9b28214eda17bf61116068113a967b560463 (patch) | |
| tree | d8fef592852f93da3a16f630bb1683f273d0243f /Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs | |
| parent | 1f9cda6a6600a81969cf8afad3c60fa77bb5a093 (diff) | |
| parent | ebc24470e34a7ba12b64ca30d4c6e67d21dbad91 (diff) | |
Merge upstream/api-migration
Diffstat (limited to 'Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs')
| -rw-r--r-- | Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs b/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs new file mode 100644 index 000000000..675f4c79e --- /dev/null +++ b/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs @@ -0,0 +1,23 @@ +using Jellyfin.Server.Models; +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(JsonOptions.PascalCase) + { + SupportedMediaTypes.Clear(); + // Add application/json for default formatter + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json")); + SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"PascalCase\"")); + } + } +} |
