diff options
| author | crobibero <cody@robibe.ro> | 2020-09-11 15:53:04 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-09-11 15:53:04 -0600 |
| commit | f13b87afa3e81e7fa2710caec58a7d6cb20f7635 (patch) | |
| tree | 0f269ac5baa27b334c5377d9dec4010aedf25183 /Jellyfin.Server/Formatters/XmlOutputFormatter.cs | |
| parent | 2363ad544979adf32207fa927f106fadb784f1fb (diff) | |
| parent | 6bf0acb854683377bebad3ca27de17706519c420 (diff) | |
Merge remote-tracking branch 'upstream/master' into api-upload-subtitle
Diffstat (limited to 'Jellyfin.Server/Formatters/XmlOutputFormatter.cs')
| -rw-r--r-- | Jellyfin.Server/Formatters/XmlOutputFormatter.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Jellyfin.Server/Formatters/XmlOutputFormatter.cs b/Jellyfin.Server/Formatters/XmlOutputFormatter.cs new file mode 100644 index 000000000..01d99d7c8 --- /dev/null +++ b/Jellyfin.Server/Formatters/XmlOutputFormatter.cs @@ -0,0 +1,32 @@ +using System.Net.Mime; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Formatters; + +namespace Jellyfin.Server.Formatters +{ + /// <summary> + /// Xml output formatter. + /// </summary> + public class XmlOutputFormatter : TextOutputFormatter + { + /// <summary> + /// Initializes a new instance of the <see cref="XmlOutputFormatter"/> class. + /// </summary> + public XmlOutputFormatter() + { + SupportedMediaTypes.Clear(); + SupportedMediaTypes.Add(MediaTypeNames.Text.Xml); + + SupportedEncodings.Add(Encoding.UTF8); + SupportedEncodings.Add(Encoding.Unicode); + } + + /// <inheritdoc /> + public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding) + { + return context.HttpContext.Response.WriteAsync(context.Object?.ToString()); + } + } +} |
