Skip to content

Commit 96d0a02

Browse files
committed
Merge pull request #440 from longwa/GRAILS-10929
GRAILS-10929 - response.redirectUrl is incorrect in test cases if controller is wrapped with CGLIB proxy
2 parents 7e9705b + 5770379 commit 96d0a02

File tree

1 file changed

+3
-2
lines changed
  • grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/api

1 file changed

+3
-2
lines changed

grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllersApi.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ public static void initialize(Object instance) {
116116
if (Environment.getCurrent() == Environment.TEST) {
117117
GrailsWebRequest webRequest = GrailsWebRequest.lookup();
118118
if (webRequest != null) {
119-
webRequest.setControllerName(GrailsNameUtils.getLogicalPropertyName(
120-
instance.getClass().getName(), ControllerArtefactHandler.TYPE));
119+
// GRAILS-10929 - If the class name ends with $$..., then it's a proxy and we want to remove that from the name
120+
String className = instance.getClass().getName().replaceAll("\\$\\$.*$", "");
121+
webRequest.setControllerName(GrailsNameUtils.getLogicalPropertyName(className, ControllerArtefactHandler.TYPE));
121122
}
122123
}
123124
}

0 commit comments

Comments
 (0)