尝试读取req.body json对象时,节点js未定义

时间:2014-02-25 10:42:30

标签: javascript json node.js http-post

我正在使用curl(curl http://localhost:8080/send -H "Content:Type: application/json" -d @data.json)向我的节点js应用程序发送一个json对象。

在调试它之后,使用node-inspector,我似乎在req.body中获得了以下内容:{ "sender_id": 1 }: "",这是我所期望的除了尾随:“”。现在,当我尝试req.body["sender_id"]时,我得到了未定义。不知道发生了什么事。

0 个答案:

没有答案