parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive
cowboy_req:parse_cookies - Parse cookie headers
parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive
Parse cookie headers.
Alias for cowboy_req:parse_header(<<"cookie">>, Req).
When the cookie header is missing, []
is returned.
While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return []
.
The Req object.
The cookies are returned as a list of key/values. Keys and values are case sensitive binary strings.
cookie/2,3
and cookies/1
.
Cookies = cowboy_req:parse_cookies(Req), {_, Token} = lists:keyfind(<<"token">>, 1, Cookies).
cowboy_req(3), cowboy_req:parse_header(3), cowboy_req:match_cookies(3)
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.