Gulp browsersync中间件中的请求对象是什么:函数(req、res、next())

Gulp browsersync中间件中的请求对象是什么:函数(req、res、next()),gulp,connect,browser-sync,Gulp,Connect,Browser Sync,Browsersync提到了以下内容 有人知道请求对象的属性吗?e、 g.如何获取请求的主机属性 middleware: function (req, res, next) { //the following prints undefined - where can we learn about res, req and next() console.log(res.getHeader('Host')); } 它似乎是一个常规节点Http.ClientRequest对象

Browsersync提到了以下内容

有人知道请求对象的属性吗?e、 g.如何获取请求的主机属性

 middleware: function (req, res, next) {
     //the following prints undefined - where can we learn about res, req and next()
     console.log(res.getHeader('Host'));
 }

它似乎是一个常规节点Http.ClientRequest对象:

例如,“headers”属性只是一个普通的JS对象:

req.headers['host']
应该给你主人


上面的代码示例试图获取响应头,而不是请求头。

它似乎是一个常规节点Http.ClientRequest对象:

例如,“headers”属性只是一个普通的JS对象:

req.headers['host']
应该给你主人


上面的代码示例试图获取响应头,而不是请求头。

不同的问题。你们知道如何使用协议来区分http和https吗?不同的问题。您知道如何使用协议来区分http和https吗?