-
• #2
The headers should be in
res
anyway? The callback only gets called once the headers have been parsed.By the way, I'll be on holiday next week, so I won't be able to answer any of your posts now until I get back.
-
• #3
Don't blame you Gordon, its a full-time job just supporting my forum posts ;)
-
• #4
function onPageRequest(req, res) { var a = url.parse(req.url, true); console.log(a); console.log(req.headers); console.log(req.method);
headers:
{ "Host": "192.168.1.13", "Connection": "keep-alive", "Cache-Control": "max-age=0", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Encoding": "gzip, deflate, sdch", "Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6" }
-
• #5
Yup perfect, thanks +Wilberforce, I completely forgot about the
.headers
prop.
Following code sample fails:
Produces only:
Change it to a GET request and you get:
but I want the HTTP headers not the content.