Created
July 2, 2014 16:41
-
-
Save alanhoff/4b170464c461294e6c0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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