【问题标题】:Meteor: what is the final Location/URL after following redirects?Meteor:重定向后的最终位置/URL 是什么?
【发布时间】:2014-05-29 19:43:44
【问题描述】:

Meteor 的 HTTP package 是 mikeal 请求的包装器,它支持 followRedirects 选项。但是,在遵循 3xx 重定向响应(并且请求没有 fail because of lack of a cookie jar)之后,如何找出最终 URL 是什么?

通过请求,最终 URL 为 response.request.href。但是使用 Meteor...?

这是流星代码:

if (Meteor.isServer) {
  Meteor.startup(function () {
    var url = 'http://google.com';
    var result = HTTP.call("HEAD", url, {
      followRedirects: true
    });
    console.log(result);  // nothing here hints at the final URL
  });
}

【问题讨论】:

    标签: javascript meteor http-redirect


    【解决方案1】:

    我已经创建了一个包 - http-more

    事实证明 Meteor 没有在响应中传回请求对象,并且鉴于 history of rejected PRs concerning enhancements to the HTTP package,我刚刚单独实现了该选项。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-07
    • 2015-09-08
    • 2013-05-02
    相关资源
    最近更新 更多