我正在尝试测试使用Node.js制作的GroupMe机器人。我正在使用GroupMe的Example Bot。运行foreman start
之后
curl -X POST -d \cool guy\ localhost:5000
(来自类似的question),我收到错误curl: (1) Protocol "guy http" not supported or disabled in libcurl
。我尝试用双引号包装消息,但这只会导致语法错误。我该如何解决这个问题?
修改:
我试过
$ curl -X POST -d "cool guy" localhost:5000
并且从工头那里得到以下错误:
22:04:16 web.1 | started with pid 5788
22:04:32 web.1 | undefined:1
22:04:32 web.1 | cool guy
22:04:32 web.1 | ^
22:04:32 web.1 | SyntaxError: Unexpected token c
22:04:32 web.1 | at Object.parse (native)
22:04:32 web.1 | at Object.respond (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\bot.js:11:24)
22:04:32 web.1 | at apply (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:448:19)
22:04:32 web.1 | at _every (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:30:9)
22:04:32 web.1 | at Router.invoke (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\router.js:454:5)
22:04:32 web.1 | at IncomingMessage.parseAndInvoke (C:\Users\Nicky\Documents\GitHub\groupme-jarvis\node_modules\director\lib\director\http\index.js:175:10)
22:04:32 web.1 | at IncomingMessage.g (events.js:199:16)
22:04:32 web.1 | at IncomingMessage.emit (events.js:104:17)
22:04:32 web.1 | at _stream_readable.js:908:16
22:04:32 web.1 | at process._tickCallback (node.js:355:11)
22:04:32 web.1 | exited with code 1
22:04:32 system | sending SIGKILL to all processes
答案 0 :(得分:0)
在localhost前添加http://。 Libcurl,curl 使用的库,支持许多不同的协议。 Curl 正确地假设了 http,但似乎有一个错误。