< Summary - Jellyfin

Information
Class: Jellyfin.Api.Formatters.CssOutputFormatter
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Formatters/CssOutputFormatter.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 35
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
WriteResponseBodyAsync(...)50%44100%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Formatters/CssOutputFormatter.cs

#LineLine coverage
 1using System.Text;
 2using System.Threading.Tasks;
 3using Microsoft.AspNetCore.Http;
 4using Microsoft.AspNetCore.Mvc.Formatters;
 5
 6namespace Jellyfin.Api.Formatters;
 7
 8/// <summary>
 9/// Css output formatter.
 10/// </summary>
 11public class CssOutputFormatter : TextOutputFormatter
 12{
 13    /// <summary>
 14    /// Initializes a new instance of the <see cref="CssOutputFormatter"/> class.
 15    /// </summary>
 2216    public CssOutputFormatter()
 17    {
 2218        SupportedMediaTypes.Add("text/css");
 19
 2220        SupportedEncodings.Add(Encoding.UTF8);
 2221        SupportedEncodings.Add(Encoding.Unicode);
 2222    }
 23
 24    /// <summary>
 25    /// Write context object to stream.
 26    /// </summary>
 27    /// <param name="context">Writer context.</param>
 28    /// <param name="selectedEncoding">Unused. Writer encoding.</param>
 29    /// <returns>Write stream task.</returns>
 30    public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
 31    {
 232        var stringResponse = context.Object?.ToString();
 233        return stringResponse is null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);
 34    }
 35}