Strict and robust way to get the redirect chain for a given url, async based. No dependencies. Fully tested with 100% code coverage. Throws on redirect loop.
// initialization
const config = {
maxRedirects: 50 // default value
}
const redirectChain = require('redirect-chain')(config);
// get urls redirect chain for an url
const urlsChain = await redirectChain.urls('https://google.com');
// [ 'https://google.com', 'https://www.google.com/' ]
// get domains redirect chain for an url
const domainsChain = await redirectChain.domains('https://google.com');
// [ 'google.com', 'www.google.com' ]
// get destination of redirect chain for an url
const domainsChain = await redirectChain.destination('https://google.com');
// 'https://www.google.com/'
MIT