cookies.d.ts 635 B

12345678910111213141516171819202122232425262728
  1. /// <reference types="node" />
  2. import type { Headers } from './fetch'
  3. export interface Cookie {
  4. name: string
  5. value: string
  6. expires?: Date | number
  7. maxAge?: number
  8. domain?: string
  9. path?: string
  10. secure?: boolean
  11. httpOnly?: boolean
  12. sameSite?: 'Strict' | 'Lax' | 'None'
  13. unparsed?: string[]
  14. }
  15. export function deleteCookie (
  16. headers: Headers,
  17. name: string,
  18. attributes?: { name?: string, domain?: string }
  19. ): void
  20. export function getCookies (headers: Headers): Record<string, string>
  21. export function getSetCookies (headers: Headers): Cookie[]
  22. export function setCookie (headers: Headers, cookie: Cookie): void