Skip to content

Instantly share code, notes, and snippets.

Created January 3, 2013 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4444409 to your computer and use it in GitHub Desktop.
Save anonymous/4444409 to your computer and use it in GitHub Desktop.
Using Request module (returns HTTP 400)
var request = require('request');
var http = require('http');
var options = {
host: 'es.motionpoint.com',
protocol: 'http:',
port: 80,
path: '/',
method: 'HEAD',
headers: {
'User-Agent': 'Mozilla/5.0+(compatible; Test/2.0; http://www.test.com/)'
}
};
request({
uri: options.protocol + '//' + options.host
method: 'GET',
}, function(error, response, body) {
if (!error) {
console.log(response.statusCode);
} else {
console.log(error.message);
console.log(options.protocol + '//' + options.host + options.path);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment