I have this nodejs code:
var http = require('http');
var options ={
host: 'www.facebook.com',
port: 80,
path: '/',
method: 'GET'
};
console.log("Going to make request...");
var req = http.get(options, function(response){
console.log(response.statusCode);
response.pipe(process.stdout);
});
It works fine the first time by returning the html. When I change "host:" from facebook.com to google.com I get a 302 error. Why do I have to redirect it? Is the first get request cached somehow?