Created
April 22, 2011 01:33
-
-
Save berngp/935846 to your computer and use it in GitHub Desktop.
Missing renderer for Unit Testing within Grails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controller.metaClass.render = {Map map, Closure closure -> | |
renderArgs.putAll(map) | |
switch(map.contentType) { | |
case null: | |
break | |
case 'application/xml': | |
case 'text/xml': | |
def smb = new StreamingMarkupBuilder() | |
if (map.encoding){ | |
smb.encoding = map.encoding | |
} | |
delegate.response.outputStream << smb.bind(closure) | |
break | |
case 'text/json': | |
new JSonBuilder(delegate.response).json(closure) | |
break | |
default: | |
println 'Nothing!!' | |
break | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment