diff options
author | Loïc Hoguin <[email protected]> | 2016-11-07 18:03:47 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-11-07 18:03:47 +0200 |
commit | 7b248e5163fd852d6defe967318da849433dadb1 (patch) | |
tree | 2db5fc09210cb77e77cf14a9ac61fef932131f15 /doc/src/manual/cowboy_req.parse_cookies.asciidoc | |
parent | bd34dfdedd369b42b1e6920f60c32b0594802aa2 (diff) | |
download | cowboy-7b248e5163fd852d6defe967318da849433dadb1.tar.gz cowboy-7b248e5163fd852d6defe967318da849433dadb1.tar.bz2 cowboy-7b248e5163fd852d6defe967318da849433dadb1.zip |
Add man pages for the parse/match/binding cowboy_req functions
Diffstat (limited to 'doc/src/manual/cowboy_req.parse_cookies.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_req.parse_cookies.asciidoc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_req.parse_cookies.asciidoc b/doc/src/manual/cowboy_req.parse_cookies.asciidoc new file mode 100644 index 0000000..c174da4 --- /dev/null +++ b/doc/src/manual/cowboy_req.parse_cookies.asciidoc @@ -0,0 +1,55 @@ += cowboy_req:parse_cookies(3) + +== Name + +cowboy_req:parse_cookies - Parse cookie headers + +== Description + +[source,erlang] +---- +parse_cookies(Req) -> [{Name, Value}] + +Name :: binary() %% case sensitive +Value :: binary() %% case sensitive +---- + +Parse cookie headers. + +Alias for link:man:cowboy_req:parse_header(3)[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 `[]`. + +== Arguments + +Req:: + +The Req object. + +== Return value + +The cookies are returned as a list of key/values. Keys and +values are case sensitive binary strings. + +== Changelog + +* *2.0*: Only the parsed header value is returned, it is no longer wrapped in a tuple. +* *2.0*: Function introduced. Replaces `cookie/2,3` and `cookies/1`. + +== Examples + +.Look for a specific cookie +[source,erlang] +---- +Cookies = cowboy_req:parse_cookies(Req), +{_, Token} = lists:keyfind(token, 1, Cookies). +---- + +== See also + +link:man:cowboy_req(3)[cowboy_req(3)], +link:man:cowboy_req:parse_header(3)[cowboy_req:parse_header(3)], +link:man:cowboy_req:match_cookies(3)[cowboy_req:match_cookies(3)] |