-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.js
More file actions
35 lines (30 loc) · 776 Bytes
/
header.js
File metadata and controls
35 lines (30 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*var request = require('request');
request( process.argv[2], function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Print the google web page.
}
});
*/
/*var request = require('request');
var options = {
url: process.argv[2],
method: "HEAD" ,
headers: {
'User-Agent': 'request'
}
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
console.log(body);
}
}
request(options, callback);
*/
var http = require('http');
var options = {method: 'HEAD', host: process.argv[2], port: 80, path: '/'};
var req = http.request(options, function(res) {
console.log(JSON.stringify(res.headers));
}
);
req.end();