diff --git a/src/Umbraco.Web/Features/DisabledFeatures.cs b/src/Umbraco.Web/Features/DisabledFeatures.cs index a4adb42557..b9d8d0a2d9 100644 --- a/src/Umbraco.Web/Features/DisabledFeatures.cs +++ b/src/Umbraco.Web/Features/DisabledFeatures.cs @@ -20,11 +20,5 @@ namespace Umbraco.Web.Features /// Gets the disabled controllers. /// public TypeList Controllers { get; private set; } - - /// - /// Specifies if rendering pipeline should ignore HasTemplate check when handling a request. - /// This is to allow JSON preview of content with no template set. - /// - public bool AllowRenderWithoutTemplate { get; set; } } } diff --git a/src/Umbraco.Web/Features/EnabledFeatures.cs b/src/Umbraco.Web/Features/EnabledFeatures.cs new file mode 100644 index 0000000000..afa1988988 --- /dev/null +++ b/src/Umbraco.Web/Features/EnabledFeatures.cs @@ -0,0 +1,22 @@ +namespace Umbraco.Web.Features +{ + /// + /// Represents enabled features. + /// + internal class EnabledFeatures + { + /// + /// Initializes a new instance of the class. + /// + public EnabledFeatures() + { + + } + + /// + /// Specifies if rendering pipeline should ignore HasTemplate check when handling a request. + /// This is to allow JSON preview of content with no template set. + /// + public bool RenderNoTemplate { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Features/UmbracoFeatures.cs b/src/Umbraco.Web/Features/UmbracoFeatures.cs index 5dc64ff5e4..8f65d6efb8 100644 --- a/src/Umbraco.Web/Features/UmbracoFeatures.cs +++ b/src/Umbraco.Web/Features/UmbracoFeatures.cs @@ -14,6 +14,7 @@ namespace Umbraco.Web.Features public UmbracoFeatures() { Disabled = new DisabledFeatures(); + Enabled = new EnabledFeatures(); } // note @@ -28,6 +29,11 @@ namespace Umbraco.Web.Features /// public DisabledFeatures Disabled { get; set; } + /// + /// Gets the enabled features. + /// + public EnabledFeatures Enabled { get; set; } + /// /// Determines whether a feature is enabled. /// @@ -39,4 +45,4 @@ namespace Umbraco.Web.Features throw new NotSupportedException("Not a supported feature type."); } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index da64048ada..c4b0593979 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -395,9 +395,10 @@ namespace Umbraco.Web.Mvc //here we need to check if there is no hijacked route and no template assigned, if this is the case //we want to return a blank page, but we'll leave that up to the NoTemplateHandler. + //we also check if we're allowed to render even though there's no template (json render in headless). if (publishedContentRequest.HasTemplate == false && routeDef.HasHijackedRoute == false && - FeaturesResolver.Current.Features.Disabled.AllowRenderWithoutTemplate == false) + FeaturesResolver.Current.Features.Enabled.RenderNoTemplate == false) { publishedContentRequest.UpdateOnMissingTemplate(); // will go 404 diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 2a164b6ea1..0d195b5630 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -329,6 +329,7 @@ +