How to extract request http headers from a request using NodeJS connect


I'd like to get the "Host" header of a request made using Node JS's connect library bundle. My code looks like:

var app = connect()
  .use(function(req, res){

    var host = req.???


The documentation for connect is here but I don't see anything detailing the API of the req object in the above code.

Edit: Note a successful answer must point to the documentation (I need this to verify which version provided the API I'm looking for).

10/30/2012 9:30:46 PM

If you use Express 4.x, you can use the req.get(headerName) method as described in Express 4.x API Reference

1/15/2016 6:04:40 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow