如何使用Meteor的HTTP.call传递X-Auth-Token?

时间:2015-11-30 10:33:30

标签: meteor http-headers

如何通过Meteor' X-Auth-Token传递HTTP.call

E.g。做这样的事情:

curl -X GET \
--header "X-Auth-Token: 1234567890abcdeff978d137bc01a2" \
https://example.com/api/call

1 个答案:

答案 0 :(得分:1)

我在Meteor's forum找到了答案:

options = {
  headers: { 'X-Auth-Token' : '1234567890abcdeff978d137bc01a2' }
}

在CoffeeScript中更详细一点:

res = HTTP.call 'GET', 'https://example.com/api/call',
  headers:
    'X-Auth-Token': auth_token
  params:
    a: 1
    b: 2