diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-07-17 16:06:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-17 16:06:52 +0100 |
| commit | 24c1776ff61481b85b016cc0fcfef0a319589fdc (patch) | |
| tree | 1612b84aa9889992f9b8b4e32ec3e16296d83bdd | |
| parent | fd2f18899b8ea4db5152d98d9822d6cff6d7d892 (diff) | |
Add files via upload
| -rw-r--r-- | Emby.Server.Implementations/Services/HttpContextExtension.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Services/HttpContextExtension.cs b/Emby.Server.Implementations/Services/HttpContextExtension.cs new file mode 100644 index 000000000..6d3a600ab --- /dev/null +++ b/Emby.Server.Implementations/Services/HttpContextExtension.cs @@ -0,0 +1,33 @@ +using MediaBrowser.Model.Services; +using Microsoft.AspNetCore.Http; + +namespace Emby.Server.Implementations.Services +{ + /// <summary> + /// Extention to enable the service stack request to be stored in the HttpRequest object. + /// </summary> + public static class HttpContextExtension + { + private const string SERVICESTACKREQUEST = "ServiceRequestStack"; + + /// <summary> + /// Set the service stack request. + /// </summary> + /// <param name="httpContext">The HttpContext instance.</param> + /// <param name="request">The IRequest instance.</param> + public static void SetServiceStackRequest(this HttpContext httpContext, IRequest request) + { + httpContext.Items[SERVICESTACKREQUEST] = request; + } + + /// <summary> + /// Get the service stack request. + /// </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]; + } + } +} |
