< Summary - Jellyfin

Information
Class: Jellyfin.Server.Filters.RetryOnTemporarilyUnavailableFilter
Assembly: jellyfin
File(s): /srv/git/jellyfin/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs
Line coverage
100%
Covered lines: 40
Uncovered lines: 0
Coverable lines: 40
Total lines: 51
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
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
Apply(...)100%11100%

File(s)

/srv/git/jellyfin/Jellyfin.Server/Filters/RetryOnTemporarilyUnavailableFilter.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using Microsoft.OpenApi.Models;
 3using Swashbuckle.AspNetCore.SwaggerGen;
 4
 5namespace Jellyfin.Server.Filters;
 6
 7internal class RetryOnTemporarilyUnavailableFilter : IOperationFilter
 8{
 9    public void Apply(OpenApiOperation operation, OperationFilterContext context)
 10    {
 38811        operation.Responses.Add(
 38812            "503",
 38813            new OpenApiResponse
 38814            {
 38815                Description = "The server is currently starting or is temporarily not available.",
 38816                Headers = new Dictionary<string, OpenApiHeader>
 38817                {
 38818                    {
 38819                        "Retry-After", new OpenApiHeader
 38820                        {
 38821                            AllowEmptyValue = true,
 38822                            Required = false,
 38823                            Description = "A hint for when to retry the operation in full seconds.",
 38824                            Schema = new OpenApiSchema
 38825                            {
 38826                                Type = "integer",
 38827                                Format = "int32"
 38828                            }
 38829                        }
 38830                    },
 38831                    {
 38832                        "Message", new OpenApiHeader
 38833                        {
 38834                            AllowEmptyValue = true,
 38835                            Required = false,
 38836                            Description = "A short plain-text reason why the server is not available.",
 38837                            Schema = new OpenApiSchema
 38838                            {
 38839                                Type = "string",
 38840                                Format = "text"
 38841                            }
 38842                        }
 38843                    }
 38844                },
 38845                Content = new Dictionary<string, OpenApiMediaType>()
 38846                {
 38847                    { "text/html", new OpenApiMediaType() }
 38848                }
 38849            });
 38850    }
 51}