Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.49 KB

MIGRATION.md

File metadata and controls

52 lines (38 loc) · 1.49 KB

MIGRATION GUIDES

Migration guide from v2.x.x to v4.0.0

The import path has been changed.

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';

The property name for passing CookieJar to Agent has been changed.

  const jar = new CookieJar();
  const agent = new HttpCookieAgent({
-   jar,
+   cookies: { jar },
  });

Using synchronous CookieJar functions by default.

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 },
  });

Migration guide from v2.x.x to v3.0.0

v3.0.0 is deprecated because it cannot work on windows. Please use v4.0.0.