mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-20 06:30:57 +01:00
Merge pull request #3508 from BaronGreenback/nullable
Part 1: nullable Emby.DLNA
This commit is contained in:
33
MediaBrowser.Common/Extensions/HttpContextExtensions.cs
Normal file
33
MediaBrowser.Common/Extensions/HttpContextExtensions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using MediaBrowser.Model.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace MediaBrowser.Common.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Static class containing extension methods for <see cref="HttpContext"/>.
|
||||
/// </summary>
|
||||
public static class HttpContextExtensions
|
||||
{
|
||||
private const string ServiceStackRequest = "ServiceStackRequest";
|
||||
|
||||
/// <summary>
|
||||
/// Set the ServiceStack request.
|
||||
/// </summary>
|
||||
/// <param name="httpContext">The HttpContext 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 ServiceStack request.
|
||||
/// </summary>
|
||||
/// <param name="httpContext">The HttpContext instance.</param>
|
||||
/// <returns>The service stack request instance.</returns>
|
||||
public static IRequest GetServiceStackRequest(this HttpContext httpContext)
|
||||
{
|
||||
return (IRequest)httpContext.Items[ServiceStackRequest];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user