Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / index / readCookie

Function: readCookie()

readCookie(request, name): string | undefined

Defined in: support/cookie.ts:56

Read a single cookie value off a request by name.

Prefers Bun's native request.cookies (Bun.CookieMap, populated on Bun.serve-served requests) and falls back to parsing the Cookie header for synthetic requests (e.g. tests) where the native map is absent.

Parameters

request

Request

name

string

Returns

string | undefined