2014-09-22 57 views
0

在Sails 0.10中,创建操作的默认REST蓝图似乎只通过查询参数接受带有新项目内容的POST。我还需要支持JSON主体的POSTing来创建项目。使用Sails REST Blueprint发布JSON正文?

所以,POST http://localhost:1337/user?username=George作品就好了,但下面不会:

POST http://localhost:1337/user 

{ 
    username: 'George' 
} 

这可能与默认的蓝图或我必须手动实现这一点?

回答

0

我错过了头: Content-Type: application/json

现在,它的工作原理就像一个冠军!