From 8a9f7dcb43c0b5e4d11bc63bfd0f23e2740fac7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= <essen@ninenines.eu>
Date: Thu, 19 Mar 2020 14:56:49 +0100
Subject: Document the new cow_cookie functions

---
 .../manual/cow_cookie.parse_set_cookie.asciidoc    | 57 ++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 doc/src/manual/cow_cookie.parse_set_cookie.asciidoc

(limited to 'doc/src/manual/cow_cookie.parse_set_cookie.asciidoc')

diff --git a/doc/src/manual/cow_cookie.parse_set_cookie.asciidoc b/doc/src/manual/cow_cookie.parse_set_cookie.asciidoc
new file mode 100644
index 0000000..6a49dde
--- /dev/null
+++ b/doc/src/manual/cow_cookie.parse_set_cookie.asciidoc
@@ -0,0 +1,57 @@
+= cow_cookie:parse_set_cookie(3)
+
+== Name
+
+cow_cookie:parse_set_cookie - Parse a set-cookie header
+
+== Description
+
+[source,erlang]
+----
+parse_set_cookie(SetCookie :: binary())
+    -> {ok, Name, Value, Attrs} | ignore
+
+Name  :: binary()
+Value :: binary()
+Attrs :: cow_cookie:cookie_attrs()
+----
+
+Parse a set-cookie header.
+
+== Arguments
+
+SetCookie::
+
+The set-cookie header value.
+
+== Return value
+
+An `ok` tuple with the cookie name, value and attributes
+is returned on success.
+
+An atom `ignore` is returned when the cookie has both
+an empty name and an empty value, and must be ignored.
+
+== Changelog
+
+* *2.9*: Function introduced.
+
+== Examples
+
+.Parse a cookie header
+[source,erlang]
+----
+case cow_cookie:parse_set_cookie(SetCookieHd) of
+    {ok, Name, Value, Attrs} ->
+        cookie_engine_set_cookie(Name, Value, Attrs);
+    ignore ->
+        do_nothing()
+end.
+----
+
+== See also
+
+link:man:cow_cookie(3)[cow_cookie(3)],
+link:man:cow_cookie:parse_cookie(3)[cow_cookie:parse_cookie(3)],
+link:man:cow_cookie:cookie(3)[cow_cookie:cookie(3)],
+link:man:cow_cookie:setcookie(3)[cow_cookie:setcookie(3)]
-- 
cgit v1.2.3

