aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Dlna/Api/DlnaServerService.cs3
-rw-r--r--Emby.Server.Implementations/Services/ServiceHandler.cs1
-rw-r--r--MediaBrowser.Common/Extensions/HttpContextExtensions.cs (renamed from Emby.Server.Implementations/Services/HttpContextExtension.cs)13
3 files changed, 9 insertions, 8 deletions
diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs
index 7e5eb8f90..a61a8d5ab 100644
--- a/Emby.Dlna/Api/DlnaServerService.cs
+++ b/Emby.Dlna/Api/DlnaServerService.cs
@@ -134,8 +134,7 @@ namespace Emby.Dlna.Api
_dlnaManager = dlnaManager;
_resultFactory = httpResultFactory;
_configurationManager = configurationManager;
- object request = httpContextAccessor?.HttpContext.Items["ServiceStackRequest"] ?? throw new ArgumentNullException(nameof(httpContextAccessor));
- Request = (IRequest)request;
+ Request = httpContextAccessor?.HttpContext.GetServiceStack() ?? throw new ArgumentNullException(nameof(httpContextAccessor));
}
private string GetHeader(string name)
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index 3997a5ddb..3d4e1ca77 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -6,6 +6,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
+using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
diff --git a/Emby.Server.Implementations/Services/HttpContextExtension.cs b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs
index 6d3a600ab..4bab42cc1 100644
--- a/Emby.Server.Implementations/Services/HttpContextExtension.cs
+++ b/MediaBrowser.Common/Extensions/HttpContextExtensions.cs
@@ -1,27 +1,28 @@
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
-namespace Emby.Server.Implementations.Services
+namespace MediaBrowser.Common.Extensions
{
/// <summary>
/// Extention to enable the service stack request to be stored in the HttpRequest object.
+ /// Static class containing extension methods for <see cref="HttpContext"/>.
/// </summary>
- public static class HttpContextExtension
+ public static class HttpContextExtensions
{
- private const string SERVICESTACKREQUEST = "ServiceRequestStack";
+ private const string SERVICESTACKREQUEST = "ServiceStackRequest";
/// <summary>
- /// Set the service stack request.
+ /// Set the ServiceStack request.
/// </summary>
/// <param name="httpContext">The HttpContext instance.</param>
- /// <param name="request">The IRequest instance.</param>
+ /// <param name="request">The service stack request instance.</param>
public static void SetServiceStackRequest(this HttpContext httpContext, IRequest request)
{
httpContext.Items[SERVICESTACKREQUEST] = request;
}
/// <summary>
- /// Get the service stack request.
+ /// Get the ServiceStack request.
/// </summary>
/// <param name="httpContext">The HttpContext instance.</param>
/// <returns>The service stack request instance.</returns>