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