Meteor HTTP无法正常工作

时间:2015-11-16 06:20:24

标签: javascript http meteor

我希望从http请求中获取JSON数据。 url允许CORS连接和注释url。在前端,模板中有一个按钮来调用此方法。它看起来像是从控制台执行功能同步'但没有得到预期的结果。 这是我的服务器端方法

fetchFromService: function() {
   // var url = "http://googleplay-jsapi.herokuapp.com/app/com.meetsapp";

    var url = "https://play-fetch.herokuapp.com/app/com.opera.mini.native.beta";
    //synchronous GET
    var result = HTTP.get(url);
    if(result.statusCode==200) {
        var respJson = JSON.parse(result.content);
        console.log("response received.");
        return respJson;
    } else {
        console.log("Response issue: ", result.statusCode);
        var errorJson = JSON.parse(result.content);
        throw new Meteor.Error(result.statusCode, errorJson.error);
    }
}

我得到的错误是: enter image description here

注释掉的url明确告诉它允许CORS请求。我仍然把它部署到我自己的服务器上。但是我得到同样的错误。

Github link of the url

我也试过Meteor.wrapAsync。它没有工作。

0 个答案:

没有答案