Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/http/util.ts>stringifyCookie

A JavaScript extension package for building strong and modern applications.
Latest
function stringifyCookie
import { stringifyCookie } from "https://deno.land/x/ayonli_jsext@v0.9.72/http/util.ts";

Converts a Cookie object to a string.

Examples

Example 1

import { stringifyCookie } from "@ayonli/jsext/http";

const cookie = stringifyCookie({
    name: "foo",
    value: "bar",
    domain: "example.com",
    path: "/",
    expires: new Date("2021-06-09T10:18:14Z"),
    httpOnly: true,
    secure: true,
    sameSite: "Strict"
});
console.log(cookie);
// foo=bar; Domain=example.com; Path=/; Expires=Wed, 09 Jun 2021 10:18:14 GMT; HttpOnly; Secure; SameSite=Strict

Returns

string