- The import path has been changed.
- The property name for passing cookiejar to agent has been changed.
- Using synchronous CookieJar functions by default.
You should import from 'http-cookie-agent/http'
instead of 'http-cookie-agent'
.
// CommonJS
- const { HttpCookieAgent } = require('http-cookie-agent');
+ const { HttpCookieAgent } = require('http-cookie-agent/http');
// ES Module
- import { HttpCookieAgent } from 'http-cookie-agent';
+ import { HttpCookieAgent } from 'http-cookie-agent/http';
const jar = new CookieJar();
const agent = new HttpCookieAgent({
- jar,
+ cookies: { jar },
});
If you use an asynchronous cookie store (e.g. redis-cookie-store
), set cookies.async_UNSTABLE
to true.
const client = redis.createClient();
const store = new RedisCookieStore(client);
const jar = new CookieJar(store);
const agent = new HttpCookieAgent({
- cookies: { jar },
+ cookies: { async_UNSTABLE: true, jar },
});
v3.0.0
is deprecated because it cannot work on windows. Please use v4.0.0.