Last active
August 29, 2015 14:02
-
-
Save L1fescape/7ca7e99a51c3a4abc049 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// npm install request | |
var request = require('request'), | |
redirectCount = 0; | |
function printRedirects(site) { | |
request(site, {followRedirect: false}, function (error, response, body) { | |
if (error){ | |
console.log(error); | |
return; | |
} | |
console.log(++redirectCount, response.statusCode, site); | |
if (response.statusCode == 301) { | |
printRedirects(response.headers.location); | |
} | |
}) | |
} | |
printRedirects('http://slate.me/1h0svt8'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment