deleteCookie
import { deleteCookie } from "jsr:@ende/http";function
function deleteCookie(headers: Headers, name: string, attributes?: Pick<Cookie, "path" | "domain" | "secure" | "httpOnly" | "partitioned">): voidSet the cookie header with empty value in the headers to delete it.
The attributes (path, domain, secure, httpOnly, partitioned) need
to match the values when the cookie was set.
Note: Deleting a
Cookiewill set its expiration date before now. Forcing the browser to delete it.
headers: HeadersThe headers instance to delete the cookie from
name: stringName of cookie
attributes?: Pick<Cookie, "path" | "domain" | "secure" | "httpOnly" | "partitioned">Additional cookie attributes
Example: Usage
import { deleteCookie } from "@ende/http/cookie";
import { assertEquals } from "@ende/assert";
const headers = new Headers();
deleteCookie(headers, "deno");
const cookieHeader = headers.get("set-cookie");
assertEquals(cookieHeader, "deno=; Expires=Thu, 01 Jan 1970 00:00:00 GMT");