axios-follow
v1.0.1
Published
Axios wrapper with automatic redirect following and cookie management.
Readme
axios-follow
Axios wrapper with automatic redirect following and cookie management.
Installation
npm install axios-followUsage
Using addFollowMethod
import axios from 'axios'
import { addFollowMethod } from 'axios-follow'
const client = addFollowMethod(axios.create())
const response = await client.follow({ url: '...' })
console.log(response.followChain) // Redirect history
console.log(response.cookies) // Cookies by domainUsing axiosFollow directly
import axios from 'axios'
import { axiosFollow } from 'axios-follow'
const response = await axiosFollow(axios, { url: 'https://example.com' }, { maxRedirects: 5 })
console.log(response.followChain) // See all steps
console.log(response.cookies) // All cookies collectedTip: For cookie conversion/manipulation, use cookie-more
Features
- Automatic redirect following
- Cookie management between requests
- Complete redirect history
- Compatible with standard Axios API
🚀 Just add the follow method to your Axios client!
