CookieFilter
Narrows which cookies cookies.get() returns.
A property left out matches every cookie, so an empty filter — or no filter at all — returns the whole store.
Example
import { session } from '@mobrowser/api';
const sessionCookies = await session.cookies.get({
url: 'https://example.com',
session: true
})
Properties
url
readonly url?: string;
Returns only cookies that would be sent to this URL.
The cookie store itself applies this, so the scheme, host, and path of the
URL are all taken into account: a secure cookie is not returned for an
http:// URL, and a cookie scoped to /admin is not returned for /.
name
readonly name?: string;
Returns only cookies with this name.
domain
readonly domain?: string;
Returns only cookies stored at or below this domain.
Asking about example.com also returns cookies stored for
www.example.com and for .example.com, which makes this the way to find
everything one site has stored. The match stops at a label boundary, so
example.com does not return cookies stored for notexample.com.
To ask the opposite question — which cookies apply to one page — use
url, which takes the scheme and path into account as well.
path
readonly path?: string;
Returns only cookies with this exact path.
secure
readonly secure?: boolean;
Returns only secure cookies when true, or only non-secure ones when false.
session
readonly session?: boolean;
Returns only session cookies when true, or only persistent ones when false.
httpOnly
readonly httpOnly?: boolean;
Returns only httpOnly cookies when true, or only the rest when false.