nodejs head request

Here’s how to do a simple head request and receive the response as a json object.

var http = require(‘http’);
var options = {method: ‘HEAD’, host: ‘google.com’, port: 80, path: ‘/’};
var req = http.request(options, function(res) { console.log(JSON.stringify(res.headers));
});
req.end();



Add a Comment

Your email address will not be published. Required fields are marked *