【发布时间】:2011-11-01 07:51:46
【问题描述】:
似乎在 Grails 中,默认 contentType 用于在使用如下内容时呈现 JSON 响应:
render Book.list(params) as JSON
是应用程序/json
当然还有一种更简单的方法来定义内容类型:
render(contentType:"text/json") {
book(title:b.title,author:b.author)
}
有没有办法使用速记方式,并且仍然得到“text/json”的响应内容类型?
注意:示例取自here
【问题讨论】:
标签: json grails content-type