A shortcut function to return summary details of last URL redirect in a chain.
For use with the Puppeteer Node library for Chromium web browser automation.
Incorporate the function into a Puppeteer script. E.g.
const puppeteer = require('puppeteer');
const lastRedirect = require('last-redirect');
(async () => {
const browser = await puppeteer.launch({});
const page = await browser.newPage()
const res = await page.goto('http://www.google.com', { waitUntil: 'networkidle2' })
console.log(lastRedirect(res));
await browser.close()
})()
{ count: 1, status: 302, statusText: 'Found' }