You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.2 KiB
34 lines
1.2 KiB
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];
|
|
}
|
|
}
|
|
}
|