Skip to main content
Module

x/another_cookiejar/mod.ts>CookieJar

https://deno.land/x/another_cookiejar
Go to Latest
class CookieJar
import { CookieJar } from "https://deno.land/x/another_cookiejar@v1.2.0/mod.ts";

Constructors

new
CookieJar(cookies?: Array<Cookie> | Array<CookieOptions>)

Properties

cookies

Methods

getCookie(options: Cookie | CookieOptions): Cookie | undefined

Gets the first cooking matching the defined properties of a given Cookie or CookieOptions. returns undefined if not found or expired. creationDate prop is not checked. Also removes the cookie and returns undefined if cookie is expired.

getCookies(options?: CookieOptions | Cookie)

returnes cookies that matches the options excluding expired ones, also removes expired cookies before returning.

getCookieString(url: string | Request | URL)
removeCookie(options: CookieOptions | Cookie): Cookie | undefined

Removes first cookie that matches the given option.

Returns the deleted cookie if found or undefined otherwise.

removeCookies(options?: CookieOptions | Cookie): Array<Cookie> | undefined

Removes all cookies that matches the given option. If options is not given, all cookies will be deleted.

Returns the deleted cookies if found or undefined otherwise.

setCookie(cookie: Cookie | string, url?: string | Request | URL)

Sets or replaces a cookie inside the jar. Only sets new cookies if cookie is valid and not expired. Validation and expiration checks are not run when replacing a cookie.