Skip to main content
Module

x/faster/mod.ts>getCookies

A fast and optimized middleware server with an absurdly small amount of code (300 lines) built on top of Deno's native HTTP APIs with no dependencies. It also has a collection of useful middlewares: log file, serve static, CORS, session, rate limit, token, body parsers, redirect, proxy and handle upload. In "README" there are examples of all the resources. Faster's ideology is: all you need is an optimized middleware manager, all other functionality is middleware.
Go to Latest
function getCookies
import { getCookies } from "https://deno.land/x/faster@v8.3/mod.ts";

Parse cookies of a header

Examples

Example 1

import { getCookies } from "https://deno.land/std@0.224.0/http/cookie.ts";

const headers = new Headers();
headers.set("Cookie", "full=of; tasty=chocolate");

const cookies = getCookies(headers);
console.log(cookies); // { full: "of", tasty: "chocolate" }

Parameters

headers: Headers

The headers instance to get cookies from

Returns

Record<string, string>

Object with cookie names as keys