跳到主要内容
CNode

请教个问题,如何在http.get(url, function(res) {}) 回调中得到请求的URL?

Xxuxianan发布于 13 年前最后回复 13 年前
290350

请教个问题,如何在 http.get(url, function(res) { // 这里如何得到请求的url? }) 回调中得到请求的URL?

打印看了下req和res里面都没有url。。 why? node.js 版本 v0.10.24

查看回复

回复 (2)

N
noodlejs#113 年前
http.get(url, function(res) {
      console.log( url );
})
Y
yorkie#213 年前
http.get(url, function(res) {
  res.url = url;
  console.log(res.url);
})

参与回复

登录后即可参与回复。登录