Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created July 2, 2014 16:41
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 alanhoff/4b170464c461294e6c0e to your computer and use it in GitHub Desktop.
Save alanhoff/4b170464c461294e6c0e to your computer and use it in GitHub Desktop.
var url = require('url');
var request = require('request');
request.get('https://google.com.br', {followRedirect : false}, function(err, res, body){
console.log('Redirecionamento:', res.headers.location);
// Para fazer o parse da url que chegou,
// por exempo https://google.com.br?token=1234
var parsed = url.parse(res.headers.location);
console.log('Token:', parsed.query.token);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment