0
當使用Request模塊時,我們如何從響應回調訪問請求參數?從請求模塊中的響應回調訪問請求參數
例如,下面的「狗」(等)值可以通過循環列表傳遞:
var u = require('util');
var url = "http://example.com/animals/%s";
request.get({uri: u.format(url, "dog")}, function (error, response, body) {
if (!error && response.statusCode == 200) {
//how could we access the value 'dog' here?
//something like this: console.log(uri.params.animal);
}
}
謝謝,它的工作原理。 – purga