Nice Pottery Mug

    axios-with-cookies
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    axios-with-cookies

    axios-with-cookies Background-Photo by Lisa Fotios

    npm license

    axios-with-cookies

    This project is a fork of axios-cookiejar-support which lacks the possibility to add configurable http(s)-agents. It is based on the initial work of Masahiro Miyashiro (@3846masa).

    Table of Contents

    Install

    npm install axios tough-cookie axios-with-cookies
    

    Usage

    import * as axios from 'axios';
    import {AxiosInstance, AxiosStatic} from 'axios';
    import {CookieJar, MemoryCookieStore} from 'tough-cookie';
    import {wrapper} from 'axios-cookiejar-support';
    
    const axiosInstance: AxiosInstance = ((axios as unknown) as AxiosStatic).create({
      httpsAgent: new HttpsCookieAgent({
        cookies: {
          jar: new CookieJar(new MemoryCookieStore(), {looseMode: true})      
        },
        rejectUnauthorized: false,
        keepAlive: true,
        timeout: 100000
      })
    });
    this.client = wrapper(axiosInstance);
    
    await this.client.get('https://example.com');

    See examples for more details.

    Contributing

    PRs welcome.

    License

    MIT (c) maugenst

    Install

    npm i axios-with-cookies

    DownloadsWeekly Downloads

    10

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    195 kB

    Total Files

    34

    Last publish

    Collaborators

    • maugenst