Write cookies
Write structured cookies or forward a raw Set-Cookie header. Supply an absolute HTTP(S) URL and a cookie domain compatible with its host. For structured writes, missing path defaults to /; missing domain defaults to the URL host.
useWebKit defaults to false. Only iOS asynchronous structured writes can select WebKit. On Android, existing write APIs submit CookieManager writes without an acceptance callback, even when they return a Promise. A true result is not a cross-platform persistence guarantee. Use flush when Android disk persistence is required.
setSync
setSync(url: string, cookie: Cookie): booleanSubmit one cookie to the default store and return true when the native method completes without an exception.
set
set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>Write one cookie to the selected store. On iOS WebKit, resolution follows the store completion callback. Android resolution confirms submission.
setManySync
setManySync(url: string, cookies: Cookie[]): booleanSubmit several cookies to the default store. Domain validation runs before writes. This API does not promise transactional rollback for storage failures.
setMany
setMany(url: string, cookies: Cookie[], useWebKit?: boolean): Promise<boolean>Write several cookies to the selected store. Apple WebKit writes run through completion callbacks. The result is true after the operation completes without an exception.
setFromResponseSync
setFromResponseSync(url: string, value: string): booleanParse or forward raw Set-Cookie text into the default store. The value argument is a response header, not a request Cookie header. Parsing behavior follows the platform.
setFromResponse
setFromResponse(url: string, value: string): Promise<boolean>Asynchronous form of the raw response-header write. It has no useWebKit argument. Do not comma-join separate Set-Cookie headers; Expires values can contain commas.
