Skip to content

Commit

Permalink
fix: removed async_UNSTABLE option because it is not working correctly (
Browse files Browse the repository at this point in the history
#874)

* closed #831
  • Loading branch information
3846masa authored May 2, 2024
1 parent 6cf3882 commit b5af18b
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 613 deletions.
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,6 @@ setGlobalDispatcher(agent);
await request('https://example.com');
```

### Using with an asynchronous Cookie store

`http-cookie-agent` use synchronous CookieJar functions by default.

Therefore, you cannot use an asynchronous Cookie store (e.g. `redis-cookie-store`) by default.

If you want to use an asynchronous Cookie store, set `cookies.async_UNSTABLE` to true.

```js
// node:http, node:https
const jar = new CookieJar();
const agent = new HttpsCookieAgent({ cookies: { async_UNSTABLE: true, jar } });
```

```js
// undici
const jar = new CookieJar();
const agent = new CookieAgent({ cookies: { async_UNSTABLE: true, jar } } });
```

### Using with another Agent library

If you want to use another Agent library, wrap the agent in `createCookieAgent`.
Expand Down
1 change: 0 additions & 1 deletion http/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type https from 'node:https';
import type { CookieJar } from 'tough-cookie';

export interface CookieOptions {
async_UNSTABLE?: true;
jar: CookieJar;
}

Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"@reactioncommerce/babel-remove-es-create-require": "1.0.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@types/deasync": "0.1.5",
"@types/needle": "3.3.0",
"@types/node": "18.19.31",
"@types/request": "2.48.12",
Expand All @@ -80,7 +79,6 @@
"agentkeepalive": "4.5.0",
"axios": "1.6.8",
"babel-jest": "29.7.0",
"deasync": "0.1.29",
"disposablestack": "1.1.4",
"got": "12.6.1",
"http-proxy-agent": "7.0.2",
Expand All @@ -100,14 +98,10 @@
"urllib": "3.23.0"
},
"peerDependencies": {
"deasync": "^0.1.26",
"tough-cookie": "^4.0.0",
"undici": "^5.11.0 || ^6.0.0"
},
"peerDependenciesMeta": {
"deasync": {
"optional": true
},
"undici": {
"optional": true
}
Expand Down
33 changes: 0 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/cookie_options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { CookieJar } from 'tough-cookie';

interface CookieOptions {
async_UNSTABLE?: true;
jar: CookieJar;
}

Expand Down
Loading

0 comments on commit b5af18b

Please sign in to comment.