diff --git a/system/coldboxModifications/RequestContextDecorator.cfc b/system/coldboxModifications/RequestContextDecorator.cfc index 23d183ff4c..6c3c96e47a 100644 --- a/system/coldboxModifications/RequestContextDecorator.cfc +++ b/system/coldboxModifications/RequestContextDecorator.cfc @@ -335,6 +335,22 @@ component accessors=true extends="preside.system.coldboxModifications.RequestCon return currentUrl.left( adminPath.len() ) == adminPath; } + public string function getApiPath() { + var path = getController().getSetting( "rest.path" ); + + path = ReReplace( path, "^([^/])", "/\1" ); + path = ReReplace( path, "([^/])$", "\1/" ); + + return path; + } + + public boolean function isApiRequest() { + var currentUrl = getCurrentUrl(); + var apiPath = getApiPath(); + + return Left( currentUrl, Len( apiPath ) ) == apiPath; + } + public void function setIsDataManagerRequest() { getRequestContext().setValue( name = "_isDataManagerRequest" @@ -1023,6 +1039,7 @@ component accessors=true extends="preside.system.coldboxModifications.RequestCon && !event.valueExists( "fwreinit" ) && !this.isBackgroundThread() && !this.isAdminRequest() + && !this.isApiRequest() && !this.isAdminUser() && event.getHTTPMethod() == "GET" && !this.getCurrentUrl().reFindNoCase( "^/asset/" ) diff --git a/system/services/rendering/DelayedViewletRendererService.cfc b/system/services/rendering/DelayedViewletRendererService.cfc index 5e01a213c5..bb1064155b 100644 --- a/system/services/rendering/DelayedViewletRendererService.cfc +++ b/system/services/rendering/DelayedViewletRendererService.cfc @@ -171,7 +171,7 @@ component { public boolean function isDelayableContext() { var event = $getRequestContext(); - if ( event.isAdminRequest() || event.isEmailRenderingContext() || event.isBackgroundThread() ) { + if ( event.isAdminRequest() || event.isEmailRenderingContext() || event.isBackgroundThread() || event.isApiRequest() ) { return false; }