supabase / ssr

Supabase clients for use in server-side rendering frameworks.
MIT License
54 stars 6 forks source link

fix: deprecate `parse`, `serialize` exports for more useful functions #14

Closed hf closed 2 months ago

hf commented 3 months ago

parse, serialize from cookie were exported as-is. That's not super useful for importing outside of the library, so they're deprecated and in their stead adding parseCookieHeader, serializeCookieHeader which works with the getAll, setAll cookie methods more ergonomically.

For example, instead of:

getAll() {
  const parsed = parse(request.headers.get('Cookie') ?? '')
  return Object.keys(parsed).map((name) => ({ name, value: parsed[name] }))
}

You can just use:

getAll() {
  return parseCookieHeader(req.headers.get('Cookie') ?? '')
}