save

open suspend override fun save(path: Path, pattern: <Error class: unknown class>): List<<Error class: unknown class>>

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

Return

The cookies that were written, so the caller can tell what the pattern selected.

Parameters

path

Where to write. Defaults to DEFAULT_SESSION_FILE in the working directory.

pattern

Only cookies whose serialized form matches are saved. Defaults to all of them. For instance Regex("(cf|\\.com|nowsecure)") keeps the cookies carrying cf, .com or nowsecure in any of their fields.

Throws

IllegalStateException

if the browser has not been started yet.