restify 示例 TODO 服务器不发送响应

restify example TODO server not sending responses

我是新手,正在开发我的第一个 API 服务器。我想查看 POST 请求的示例,因此我安装了 restify 3.0.3 并尝试 运行 TODO 服务器示例。我看到服务器上记录了请求,但没有发送任何响应。我正在使用提供的示例 curl 请求,并且服务器在 Cloud9 上 运行ning。 Curl 在 windows 7.

上 运行ning

例如,我试过:

有人能帮忙吗?

我在使用 PostMan 练习示例时看到了相同的行为。

设置 PostMan Header Accept:text/plainAccept:application/json 对我有用。

顺便说一句:如果您设置 Accept:text/html,您应该会收到有用的回复:

{
  "code": "NotAcceptableError",
  "message": "Server accepts: application/todo,application/json,text/plain,application/octet-stream,application/javascript"
}

希望对您有所帮助。