axios-cookiejar-support
TypeScript icon, indicating that this package has built-in type declarations

5.0.5 • Public • Published

axios-cookiejar-support

axios-cookiejar-support

github sponsors npm license standard-readme compliant

Add tough-cookie support to axios.

Table of Contents

Install

npm install axios tough-cookie axios-cookiejar-support

Usage

import axios from 'axios';
import { wrapper } from 'axios-cookiejar-support';
import { CookieJar } from 'tough-cookie';

const jar = new CookieJar();
const client = wrapper(axios.create({ jar }));

await client.get('https://example.com');

See examples for more details.

Extended Request Config

import type { CookieJar } from 'tough-cookie';

declare module 'axios' {
  interface AxiosRequestConfig {
    jar?: CookieJar;
  }
}

See also https://github.com/axios/axios#request-config .

FAQ

  • Q. Why can't I assign the httpAgent / httpsAgent?
    • A. axios-cookiejar-support uses httpAgent / httpsAgent to read and write cookies. If other Agents are assigned, cookies cannot be read/written.
  • Q. I want to use it with another Agent (e.g., http-proxy-agent).
    • A. Consider using http-cookie-agent. axios-cookiejar-support also uses http-cookie-agent. Read http-cookie-agent's README for more details.

Contributing

PRs accepted.

License

MIT (c) 3846masa

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.0.521,924latest

Version History

VersionDownloads (Last 7 Days)Published
5.0.521,924
5.0.4963
5.0.313,114
5.0.219,769
5.0.12,433
5.0.09,628
4.0.730,767
4.0.63,411
4.0.54
4.0.412
4.0.3740
4.0.2230
4.0.150
3.0.04
2.0.519,790
2.0.412,412
2.0.319,809
2.0.23
2.0.13
2.0.011
1.0.130,540
1.0.015,296
0.5.11,247
0.5.014
0.4.22,178
0.4.13
0.4.01
0.3.619
0.3.59
0.3.42
0.3.31
0.3.22
0.3.11
0.3.09
0.2.11
0.2.02
0.1.42
0.1.31

Package Sidebar

Install

npm i axios-cookiejar-support

Weekly Downloads

45,818

Version

5.0.5

License

MIT

Unpacked Size

7.93 kB

Total Files

6

Last publish

Collaborators

  • 3846masa