setCookie

suspend fun setCookie(args: Network.SetCookieParameter, mode: CommandMode = CommandMode.DEFAULT): Network.SetCookieReturn

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.


suspend fun setCookie(name: String, value: String, url: String? = null, domain: String? = null, path: String? = null, secure: Boolean? = null, httpOnly: Boolean? = null, sameSite: Network.CookieSameSite? = null, expires: Double? = null, priority: Network.CookiePriority? = null, sameParty: Boolean? = null, sourceScheme: Network.CookieSourceScheme? = null, sourcePort: Int? = null, partitionKey: Network.CookiePartitionKey? = null): Network.SetCookieReturn

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

Parameters

name

Cookie name.

value

Cookie value.

url

The request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie.

domain

Cookie domain.

path

Cookie path.

secure

True if cookie is secure.

httpOnly

True if cookie is http-only.

sameSite

Cookie SameSite type.

expires

Cookie expiration date, session cookie if not set

priority

Cookie Priority type.

sameParty

True if cookie is SameParty.

sourceScheme

Cookie source scheme type.

sourcePort

Cookie source port. Valid values are {-1, 1, 65535}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future.

partitionKey

Cookie partition key. If not set, the cookie will be set as not partitioned.