parse-set-cookie ( string -- seq )


Vocabulary
http

Inputs
stringan object


Outputs
seqan object


Definition


: parse-set-cookie ( string -- seq )
[
f swap (parse-set-cookie) [
swapd pick >lower {
{ "version" [ >>version ] }
{ "comment" [ >>comment ] }
{ "expires" [ ~quotation~ unless-empty ] }
{
"max-age"
[ string>number seconds >>max-age ]
}
{ "domain" [ >>domain ] }
{ "path" [ >>path ] }
{ "httponly" [ drop t >>http-only ] }
{ "secure" [ drop t >>secure ] }
{ "priority" [ >>priority ] }
{ "samesite" [ >>samesite ] }
{ "sameparty" [ >>sameparty ] }
{ "hostprefix" [ >>hostprefix ] }
{ "domainprefix" [ >>domainprefix ] }
[ drop rot <cookie> dup , ]
} case nip
] assoc-each drop
] { } make ;