Meteor.http.call 方法
问题描述:
我正在尝试使用
if (Meteor.is_server) {
Meteor.startup(function () {
// code to run on server at startup
var result = Meteor.http.call("POST", "url",
{params:{"name" : "def"},headers:{"content-type":"application/json"}}, function (error,result) {
console.log(result);
});
});
}
出现错误
数据:{消息:'无法解析JSON,请仔细检查语法和编码:\nname=def\n ^' }
I am getting error
data: { message: 'Could not parse JSON, please double-check syntax and encoding: \nname=def\n ^' }
答
谢谢.
通过将params"替换为data"解决的问题.
The problem solved by replacing 'params' with 'data'.