Emr*_*nci 5 http-get node.js meteor
我的代码中有以下行:
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);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Error: Exceeded maxRedirects. Probably stuck in a redirect loop
Run Code Online (Sandbox Code Playgroud)
我尝试使用其他URL相同的代码,它可以工作,但它正在使用NTY网址抛出此异常.我基本上试图获得页面的HEAD.
用这个.
在你的http.get电话中你应该通过{jar: true}
例如:
HTTP.get(url, {jar: true})
Run Code Online (Sandbox Code Playgroud)
这至少对我有用:)