aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2020-04-29 07:38:18 -0600
committerGitHub <noreply@github.com>2020-04-29 07:38:18 -0600
commitd491b1b45fc813cb3bd1fe87918f693897621555 (patch)
tree4bb52a35e9cd7cd0326c6c89d80b5349b3dfee0a /Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs
parent068368df6352cfad4e69df599c364b3f05b367ba (diff)
parent2cb0f6f1263cabee288ab30109b55c57e24c7ed0 (diff)
Merge branch 'api-migration' into redoc
Diffstat (limited to 'Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs')
-rw-r--r--Jellyfin.Server/Formatters/PascalCaseJsonProfileFormatter.cs23
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\""));
+ }
+ }
+}