0
Generic Rails API使用jbuilder來渲染結果。如何使rails API能夠接受json參數而不是http
的HTTP PARAMS用於發送數據到Rails API服務器,就像這樣:
POST user_id=10&post[0][msg]=text&post[1][post_id]=15&post[1][msg]=message
如何使API能夠接受JSON入境則params的,而不是HTTP,像這樣:
POST {user_id:10,post:[{msg:'text'},{post_id:15,msg:'message'}]}
當您在Post請求中傳遞json內容類型時應該已經有效。 –
這實際上是答案。 –
@Julia將複製作爲答案。 –