ruthst00 commented on code in PR #16516:
URL: https://github.com/apache/grails-core/pull/16516#discussion_r4217518712
##########
grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/mvc/UrlMappingsHandlerMappingSpec.groovy:
##########
@@ -319,4 +377,44 @@ class FooController {
def notFound() {
RequestContextHolder.currentRequestAttributes().response.writer <<
"Not Found"
}
+
+ /**
+ * Simulates render(text: 'hello') or render(template: '_partial'): sets
renderView=false,
+ * writes content, returns null. The adapter must return null so
DispatcherServlet does not
+ * attempt view resolution. (#15819)
+ */
+ @Action
+ def renderText() {
+ def webRequest = RequestContextHolder.currentRequestAttributes()
+ webRequest.renderView = false
+ webRequest.response.writer.write('hello')
+ null
+ }
+
+ /**
+ * Simulates an action that calls render(text:) but also returns a Map —
the bug scenario
+ * from #15819 where the adapter previously ignored renderView=false when
result instanceof Map.
+ */
+ @Action
+ def renderTextWithMap() {
+ def webRequest = RequestContextHolder.currentRequestAttributes()
Review Comment:
Tests now call `render()` directly. Also added a test case where an action
sets an error status AND returns a model to prove the guard doesn't swallow
error views:
https://github.com/apache/grails-core/pull/16516/changes/ba4575019ce032554682711fcd2c16c84d52845c
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]