2014-04-15 27 views
1

流星的HTTP package是mikeal的請求包裝,它支持followRedirects選項。但是,在遵循3xx重定向響應(並且請求沒有fail because of lack of a cookie jar)後,如何找出最終的URL?流星:重定向後的最終位置/網址是什麼?

有了請求,最終的URL在response.request.href。但是流星......?

這裏的流星代碼:

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 
    }); 
} 

回答

4

我創建了一個包,這是否 - http-more

原來流星不回傳響應中的請求對象,並給出history of rejected PRs concerning enhancements to the HTTP package,我剛剛分別實現了該選項。

+0

似乎你的包的鏈接應該是:https://github.com/StockBase/meteor-http-更多 –

+0

@JulienLeCoupanec:正確的GitHub鏈接是https://github.com/dandv/meteor-http -更多 –