我正在尝试使用 coffeeScript 发出 get 请求,但它甚至没有向我的 URL 发出请求:
module.exports = (robot) ->
robot.respond /foo (.*) bar (.*) foobar (.*) /i, (msg) ->
foo = msg.match[1]
bar = msg.match[2]
foobar = msg.match[3]
robot.http("http://localhost:8000/a/")
.query({
'foo': foo
'bar': bar
'foobar': foobar
})
.get() (err, res, body) ->
json = JSON.parse(body)
msg.send(json)
当我使用浏览器发出相同的请求时,它可以工作:
http://localhost:8000/a/?foo=1&bar=2&foobar=3
我正在尝试运行hubot
hubot 1 bar 2 foobar 3