DefaultCookieJar

open class DefaultCookieJar(browser: Browser) : CookieJar

Default CookieJar, talking to the browser over its own connection.

Cookies live at browser level, so every call goes through Browser.connection rather than through one of the tabs.

Constructors

Link copied to clipboard
constructor(browser: Browser)

Functions

Link copied to clipboard
open suspend override fun clear()

Removes every cookie from the browser, for all of its tabs and windows.

Link copied to clipboard
open suspend override fun getAll(): List<Network.Cookie>

Returns every cookie currently held by the browser.

Link copied to clipboard
open suspend override fun load(path: Path = Path(DEFAULT_SESSION_FILE), pattern: Regex = Regex(".*")): List<Network.Cookie>

Restores cookies previously written by save and hands them to the browser.

Link copied to clipboard
open suspend override fun save(path: Path = Path(DEFAULT_SESSION_FILE), pattern: Regex = Regex(".*")): List<Network.Cookie>

Writes the cookies to path as JSON, so a later load can restore the session.

Link copied to clipboard
open suspend override fun setAll(cookies: List<Network.CookieParam>)

Adds the given cookies to the browser, replacing any that already exist with the same name, domain and path. Cookies absent from cookies are left untouched, use clear to drop them.