purescript-hyper / hyper

Type-safe, statically checked composition of HTTP servers

Home Page:https://hyper.wickstrom.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handle `Set-Cookie` attributes

paluh opened this issue · comments

commented

Hyper's setCookie is missing Set-Cookie attributes setup.

I've implemented attribute handling on this branch.

Some notes:

  • I've added Hyper.Cookie.setCookieHeaderValue function (separate from setCookie) because I want to reuse this serializer in hyperdrive application context

  • I've added this attributes setup to Hyper.Session.saveSession: SameSite=Lax;HttpOnly, but probably this setup should be even more configurable

  • I've added this attribute setup to Hyper.Session.deleteSession: MaxAge=0

  • In theory we should allow setup of multiple Set-Cookie headers, but I've read that fortunately it is not widely adopted, so we can stick probably with current behavior

  • I'm really open to any suggestion to improve/change coding style of my chages

Should I provide PR with these changes?

Very nice! Let me look at this after work and get back to you. Thanks! 👍

commented

I've merged this PR already.