tough-cookie.cookiejar.getcookiessync.md
July 9, 2025 ยท View on GitHub
Home > tough-cookie > CookieJar > getCookiesSync
CookieJar.getCookiesSync() method
Synchronously retrieve the list of cookies that can be sent in a Cookie header for the current URL.
Note: Only works if the configured Store is also synchronous.
Signature:
getCookiesSync(url: string, options?: GetCookiesOptions): Cookie[];
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
url |
string |
The domain to store the cookie with. |
|
options |
(Optional) Configuration settings to use when retrieving the cookies. |
Returns:
Cookie[]
Remarks
-
The array of cookies returned will be sorted according to cookieCompare().
-
The Cookie.lastAccessed property will be updated on all returned cookies.