North Pittsburgh Meatpackers

    redirect-chain

    1.0.1 • Public • Published

    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

    Install

    npm i redirect-chain

    DownloadsWeekly Downloads

    70

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    6

    Last publish

    Collaborators

    • edouarddemotes
    • dt-tractr