{[错误:失败[405]不允许HTTP方法,支持的方法:POST]堆栈:[Getter]}

时间:2017-03-08 08:57:15

标签: javascript http meteor

我想为流星平台内建的网站做一个PredictionIO推荐。 代码是:

getUserRecommendations: function (num) {
    var userId = Meteor.userId();
    check(userId, String);
    this.unblock();
    try {
        var result = HTTP.call('GET', "http://localhost:8000/queries.json",
        { params: { "user": [userId] , "num" : 4 } });
        return result;
    } catch (e) {
        console.log(e);
        return "\n" +e;
    }
}

错误来自Meteor服务器:

 { [Error: failed [405] HTTP method not allowed, supported methods: POST] stack: [Getter] }

1 个答案:

答案 0 :(得分:3)

使用POST而不是GET。您的服务器无法处理GET请求