HTTP.get请求卡在重定向循环中

时间:2014-03-08 20:37:12

标签: node.js meteor http-get

我的代码中有以下行:

postUrl =  "http://www.nytimes.com/2014/03/08/world/asia/ malaysia-airlines-says-plane-with-over-200-aboard-is-missing.html";

var htmlResult = cheerio.load(Meteor.http.call("GET", postUrl, {options: {followRedirects:false}}).content);

我收到以下错误:

Error: Exceeded maxRedirects. Probably stuck in a redirect loop

我尝试使用其他网址的相同代码并且它可以正常工作但是它正在使用NTY网址抛出此异常。我基本上试图获得页面的HEAD。

2 个答案:

答案 0 :(得分:8)

使用this

http.get来电中,您应该通过{jar: true}

例如:

HTTP.get(url, {jar: true})

至少这对我有用:)

答案 1 :(得分:0)

您的网址中有空格。这会导致问题吗?

相关问题