spudly/http-fantasy-land

getCookie, setCookie

Closed this issue · 2 comments

Add support for request.cookies and response.cookies keys.

Alternatively, maybe we should just have a route function (cookies(route) => route) that handles this for us. This way, it's just opt-in syntactic sugar for request.headers['cookie'] and response.headers['set-cookie'].

The function would have 2 functions:

  1. Parsing request.headers['cookie'] into request.cookies
  2. Serializing response.cookies as response.headers['set-cookie']

Opting to create two helper functions instead: getCookie and setCookie