Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

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.

License

tractr/redirect-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redirect-chain

Description

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.

Usage

// 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('http://google.com');
// [ 'http://google.com', 'http://www.google.com/' ]

// get domains redirect chain for an url
const domainsChain = await redirectChain.domains('http://google.com');
// [ 'google.com', 'www.google.com' ]

// get destination of redirect chain for an url
const domainsChain = await redirectChain.destination('http://google.com');
// 'http://www.google.com/'

License

MIT

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published