2016-04-28 61 views
0

斯卡拉新手讓我變得輕鬆!將表格數據噴塗到案例分類

我正在使用噴atm和發佈請求英寸我正在尋找將發佈數據轉換爲案例類,但它會引發錯誤could not find implicit value for parameter um: spray.httpx.unmarshalling.FromRequestUnmarshaller。我可能會做什麼不正確?文檔有點混亂。

post { 
    entity(as[TextMessage]) { txt => 
     println(txt.body) 
     complete("") 
    } 
} 

我的案例類case class TextMessage(body: String, from: String)

從文檔這應該工作了蝙蝠。

想法?

編輯:數據沒有被公佈爲JSON它張貼形式的數據,即application/x-www-form-urlencoded

回答

0

確保JsonFormat了的TextMessage類型的範圍,使噴塗CAND找出如何馬歇爾說類型。

入住這link

+0

的反應沒有被髮布到我JSON是表單數據的'應用程序/ x-WWW的形式,urlencoded' – user3750194