如何通过Meteor' X-Auth-Token
传递HTTP.call
?
E.g。做这样的事情:
curl -X GET \
--header "X-Auth-Token: 1234567890abcdeff978d137bc01a2" \
https://example.com/api/call
答案 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