1
我正在嘗試使用自定義contentType爲Grails中的響應呈現文本。我期望的contentType是:應用/ vnd.api + JSON使用Grails中的自定義MIME類型呈現視圖
我用下面的
render(contentType: "application/vnd.api+json") {
message = 'some text'
foo = 'bar'
}
不渲染拋出異常消息是缺失的性能測試。
雖然以下工作正常:
render(contentType: "text/json") {
message = 'some text'
foo = 'bar'
}
我Config.groovy中有下JSON mime.type如下:
grails.mime.types = [
...
json: [
'application/json',
'text/json',
'application/vnd.api+json'
],
...
]
我的問題,如何使一個自定義MIME類型的Grails的?
accept.header是假,使它沒有幫助!我仍然得到一個例外「消息是一個缺失的屬性」 –
@Armand請求標頭是怎麼樣的? – dmahapatro
這使得罰款:與文本/ json http://pastebin.com/0kPhTFv8 這與application/vnd.api + json http://pastebin.com/PL0F7Pcj結果在錯誤 –