I am attempting to render text for reponse in Grails with a custom contentType. My desired contentType is: application/vnd.api+json
I am testing with the following
render(contentType: "application/vnd.api+json") {
message = 'some text'
foo = 'bar'
}
which does not render throwing an exception that message is a missing property.
While the following works fine:
render(contentType: "text/json") {
message = 'some text'
foo = 'bar'
}
My Config.groovy has the following under json mime.type:
grails.mime.types = [
...
json: [
'application/json',
'text/json',
'application/vnd.api+json'
],
...
]
My question, how to render with a custom mime-type in Grails?