mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 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:
18
types/tough-cookie-file-store/index.d.ts
vendored
18
types/tough-cookie-file-store/index.d.ts
vendored
@@ -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,
|
||||
|
||||
@@ -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 */
|
||||
/*
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"tough-cookie": ["tough-cookie/v2"]
|
||||
},
|
||||
"paths": {},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user