Revert "Temp8 tinymce"
This commit is contained in:
31
src/Umbraco.Web/WebApi/WebApiHelper.cs
Normal file
31
src/Umbraco.Web/WebApi/WebApiHelper.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.Hosting;
|
||||
using System.Web.Http.Routing;
|
||||
|
||||
namespace Umbraco.Web.WebApi
|
||||
{
|
||||
internal static class WebApiHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper method to create a WebAPI HttpControllerContext which can be used to execute a controller manually
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="uri"></param>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <returns></returns>
|
||||
internal static HttpControllerContext CreateContext(HttpMethod method, Uri uri, HttpContextBase httpContext)
|
||||
{
|
||||
var config = new HttpConfiguration(GlobalConfiguration.Configuration.Routes);
|
||||
IHttpRouteData route = new HttpRouteData(new HttpRoute());
|
||||
var req = new HttpRequestMessage(method, uri);
|
||||
req.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;
|
||||
req.Properties[HttpPropertyKeys.HttpRouteDataKey] = route;
|
||||
req.Properties["MS_HttpContext"] = httpContext;
|
||||
return new HttpControllerContext(config, route, req);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user