tough-cookie.cookiejar.getcookies_2.md
July 9, 2025 ยท View on GitHub
Home > tough-cookie > CookieJar > getCookies
CookieJar.getCookies() method
Retrieve the list of cookies that can be sent in a Cookie header for the current URL.
Signature:
getCookies(url: string | URL, options: GetCookiesOptions | undefined, callback: Callback<Cookie[]>): void;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
url |
string | URL |
The domain to store the cookie with. |
|
options |
GetCookiesOptions | undefined |
Configuration settings to use when retrieving the cookies. |
|
callback |
A function to call after a cookie has been successfully retrieved. |
Returns:
void
Remarks
-
The array of cookies returned will be sorted according to cookieCompare().
-
The Cookie.lastAccessed property will be updated on all returned cookies.