🤖 Merge PR #50199 [tough-cookie-file-store] Fixed missing support for allowSpecialUseDomain by @Inrixia

* Fixed missing support for allowSpecialUseDomain

* Fixed unexpected path mapping

* Added overload for findCookies

* Updated all types to be in line with the current state of the package
This commit is contained in:
Inrixia
2020-12-23 01:17:33 +13:00
committed by GitHub
parent 1f786c3fb4
commit 618bfe85fd
3 changed files with 15 additions and 16 deletions

View File

@@ -19,8 +19,6 @@ export class FileCookieStore extends tough.Store {
constructor(filePath: string);
checkExpired(domain: string | null, path: string | null, key: string | null): boolean;
findCookie(
domain: string,
path: string,
@@ -31,19 +29,21 @@ export class FileCookieStore extends tough.Store {
findCookies(
domain: string,
path: string,
cb: (err: null, cookies: tough.Cookie[]) => void
cb: (err: Error | null, cookie: tough.Cookie[]) => void
): void;
findCookies(
domain: string,
path: string,
allowSpecialUseDomain: boolean,
cb: (err: Error | null, cookie: tough.Cookie[]) => void
): void;
getAllCookies(cb: (err: Error | null, cookies: tough.Cookie[]) => void): void;
inspect(): string;
isEmpty(): boolean;
isExpired(): boolean;
putCookie(cookie: tough.Cookie, cb: (err: Error | null) => void): void;
removeAllCookies(cb: (err: Error | null) => void): void;
removeCookie(
domain: string,
path: string,

View File

@@ -2,10 +2,11 @@ import { FileCookieStore } from 'tough-cookie-file-store';
import { CookieJar } from 'tough-cookie';
new CookieJar(new FileCookieStore('./cookie.json'));
/* check if cookie is empty or expired */
const cookieInstance = new FileCookieStore('./cookie.json');
cookieInstance.isExpired(); // will return True if the cookie is expired
cookieInstance.isEmpty(); // will return True if cookie is empty
// Disabled as isExpired and isEmpty have been removed.
// /* check if cookie is empty or expired */
// const cookieInstance = new FileCookieStore('./cookie.json');
// cookieInstance.isExpired(); // will return True if the cookie is expired
// cookieInstance.isEmpty(); // will return True if cookie is empty
/* request example */
/*

View File

@@ -13,9 +13,7 @@
"../"
],
"types": [],
"paths": {
"tough-cookie": ["tough-cookie/v2"]
},
"paths": {},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},