< Summary - Jellyfin

Information
Class: Jellyfin.Api.Middleware.QueryStringDecodingMiddleware
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 38
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
.ctor(...)100%11100%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs

#LineLine coverage
 1using System.Threading.Tasks;
 2using Microsoft.AspNetCore.Http;
 3using Microsoft.AspNetCore.Http.Features;
 4
 5namespace Jellyfin.Api.Middleware;
 6
 7/// <summary>
 8/// URL decodes the querystring before binding.
 9/// </summary>
 10public class QueryStringDecodingMiddleware
 11{
 12    private readonly RequestDelegate _next;
 13
 14    /// <summary>
 15    /// Initializes a new instance of the <see cref="QueryStringDecodingMiddleware"/> class.
 16    /// </summary>
 17    /// <param name="next">The next delegate in the pipeline.</param>
 18    public QueryStringDecodingMiddleware(RequestDelegate next)
 19    {
 2220        _next = next;
 2221    }
 22
 23    /// <summary>
 24    /// Executes the middleware action.
 25    /// </summary>
 26    /// <param name="httpContext">The current HTTP context.</param>
 27    /// <returns>The async task.</returns>
 28    public async Task Invoke(HttpContext httpContext)
 29    {
 30        var feature = httpContext.Features.Get<IQueryFeature>();
 31        if (feature is not null)
 32        {
 33            httpContext.Features.Set<IQueryFeature>(new UrlDecodeQueryFeature(feature));
 34        }
 35
 36        await _next(httpContext).ConfigureAwait(false);
 37    }
 38}