New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

axios-cookie

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cookie

Axios CookieJar Support

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

A Cookie support library for Axios, automatically manages cookies on request, just like request.Session.

Documentation

See the Documentation for details.

Example


import { setupCookieJar } from 'axios-cookie'
import axios from 'axios'

// Create a Axios instance
const instance = axios.create()
// Setup CookieJar, All cookies will be stored here.
const jar = setupCookieJar(instance,<adapter?>)

// Access value in CookieJar through Key.
jar.setValue(<url>,'key','value')
jar.getValue(<url>,'key')

// Remove a key
jar.setValue(<url>,null)

// Send a Request that will include the `Cookie` header configured in CookieJar.
instance.get(<url>);

// Get the Cookie Header value for site <url>.
jar.getCookie(<url>)
// Put Set-Cookie Header into the CookieJar.
jar.setCookie(<url>,<set-cookie>)

// Import from/Export to JSON Object.
jar.toJSON()
jar.fromJSON(obj)

// Get the internal CookieJar Storage, `cookiejar` or `tough-cookie`.
jar.toRaw()

Adapters

There are currently two CookieJar stores supported by default:

  • SimpleCookieJarAdapter, powered by cookiejar. [default,built-in]. Very fast and tiny, x5~x6 faster than tough-cookie. The original version has too few functions and has been modified to adapt to the new functions. Built-in features, no additional installation required.
  • ToughCookieJarAdapter, powered by tough-cookie. Slow and large, but powerful! Need to install tough-cookie manually.

Test

npm run test
# or
yarn run test
# or
node --test

LICENSE

MIT License

FAQs

Package last updated on 13 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts