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.1 KiB
34 lines
1.1 KiB
5 years ago
|
using MediaBrowser.Model.Services;
|
||
|
using Microsoft.AspNetCore.Http;
|
||
|
|
||
5 years ago
|
namespace MediaBrowser.Common.Extensions
|
||
5 years ago
|
{
|
||
|
/// <summary>
|
||
5 years ago
|
/// Static class containing extension methods for <see cref="HttpContext"/>.
|
||
5 years ago
|
/// </summary>
|
||
5 years ago
|
public static class HttpContextExtensions
|
||
5 years ago
|
{
|
||
5 years ago
|
private const string SERVICESTACKREQUEST = "ServiceStackRequest";
|
||
5 years ago
|
|
||
|
/// <summary>
|
||
5 years ago
|
/// Set the ServiceStack request.
|
||
5 years ago
|
/// </summary>
|
||
|
/// <param name="httpContext">The HttpContext instance.</param>
|
||
5 years ago
|
/// <param name="request">The service stack request instance.</param>
|
||
5 years ago
|
public static void SetServiceStackRequest(this HttpContext httpContext, IRequest request)
|
||
|
{
|
||
|
httpContext.Items[SERVICESTACKREQUEST] = request;
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
5 years ago
|
/// Get the ServiceStack request.
|
||
5 years ago
|
/// </summary>
|
||
|
/// <param name="httpContext">The HttpContext instance.</param>
|
||
|
/// <returns>The service stack request instance.</returns>
|
||
|
public static IRequest GetServiceStack(this HttpContext httpContext)
|
||
|
{
|
||
|
return (IRequest)httpContext.Items[SERVICESTACKREQUEST];
|
||
|
}
|
||
|
}
|
||
|
}
|