From f5f890e68562e55d4bed16c454c4b4305152b296 Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Tue, 31 Jan 2023 12:18:10 +0100 Subject: Migrate to file-scoped namespaces --- .../Middleware/QueryStringDecodingMiddleware.cs | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs') diff --git a/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs b/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs index 4b6304e0e..cb4169e99 100644 --- a/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs +++ b/Jellyfin.Api/Middleware/QueryStringDecodingMiddleware.cs @@ -2,38 +2,37 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http.Features; -namespace Jellyfin.Api.Middleware +namespace Jellyfin.Api.Middleware; + +/// +/// URL decodes the querystring before binding. +/// +public class QueryStringDecodingMiddleware { + private readonly RequestDelegate _next; + /// - /// URL decodes the querystring before binding. + /// Initializes a new instance of the class. /// - public class QueryStringDecodingMiddleware + /// The next delegate in the pipeline. + public QueryStringDecodingMiddleware(RequestDelegate next) { - private readonly RequestDelegate _next; + _next = next; + } - /// - /// Initializes a new instance of the class. - /// - /// The next delegate in the pipeline. - public QueryStringDecodingMiddleware(RequestDelegate next) + /// + /// Executes the middleware action. + /// + /// The current HTTP context. + /// The async task. + public async Task Invoke(HttpContext httpContext) + { + var feature = httpContext.Features.Get(); + if (feature is not null) { - _next = next; + httpContext.Features.Set(new UrlDecodeQueryFeature(feature)); } - /// - /// Executes the middleware action. - /// - /// The current HTTP context. - /// The async task. - public async Task Invoke(HttpContext httpContext) - { - var feature = httpContext.Features.Get(); - if (feature is not null) - { - httpContext.Features.Set(new UrlDecodeQueryFeature(feature)); - } - - await _next(httpContext).ConfigureAwait(false); - } + await _next(httpContext).ConfigureAwait(false); } } -- cgit v1.2.3