Fixes: #U4-2343 for api controllers, already fixed for surface controllers

This commit is contained in:
Shannon
2013-06-18 15:46:36 +10:00
parent f7c474ac2c
commit 273c1956ab
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Umbraco.Web.Mvc
{
foreach (var s in apiControllers)
{
this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "Api", "", UrlParameter.Optional, "api", isMvc: false);
this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "", UrlParameter.Optional, "api", isMvc: false);
}
}
}
+2 -3
View File
@@ -209,9 +209,8 @@ namespace Umbraco.Web
var meta = PluginController.GetMetadata(controller);
var route = RouteTable.Routes.MapHttpRoute(
string.Format("umbraco-{0}-{1}", "api", meta.ControllerName),
umbracoPath + "/Api/" + meta.ControllerName + "/{action}/{id}",//url to match
new { controller = meta.ControllerName, id = UrlParameter.Optional },
new { controller = @"(\w+)Api" }); //Must be suffixed with "Api" (i.e. MyApiController)
umbracoPath + "/Api/" + meta.ControllerName + "/{action}/{id}", //url to match
new {controller = meta.ControllerName, id = UrlParameter.Optional});
//web api routes don't set the data tokens object
if (route.DataTokens == null)
{