View Source CookieJar (cookie_jar v1.1.0)

CookieJar is here to store your cookie

Link to this section Summary

Functions

See what's in the cookie jar, the individual cookies

See what's in the cookie jar, the individual cookies available to a URI

Pour cookies into a cookie jar

Pour cookies into a cookie jar, using cookie strings and a uri string

Put cookie into a cookie jar

Put new cookie into a cookie jar

Create a new cookie jar

Destroy a cookie jar

Get the cookies in Cookie format

Get the cookies in Cookie format for the given URI

Link to this section Functions

See CookieJar.to_string/1.

See CookieJar.to_string/2.

See CookieJar.start_link/1.

@spec peek(GenServer.server()) :: map()

See what's in the cookie jar, the individual cookies

examples

Examples

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"name", "john doe"})
iex> CookieJar.peek(jar)
%{"name" => "john doe"}
@spec peek(GenServer.server(), String.t()) :: map()

See what's in the cookie jar, the individual cookies available to a URI

@spec pour(GenServer.server(), list() | map()) :: :ok

Pour cookies into a cookie jar

examples

Examples

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.pour(jar, %{"a" => 1, "b" => 2})
iex> CookieJar.peek(jar)
%{"a" => 1, "b" => 2}
Link to this function

pour(jar, cookie_strs, uri_str)

View Source
@spec pour(GenServer.server(), list(), String.t()) :: :ok

Pour cookies into a cookie jar, using cookie strings and a uri string

@spec put(GenServer.server(), CookieJar.Cookie.t() | {term(), term()}) :: :ok

Put cookie into a cookie jar

examples

Examples

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put(jar, {"b", 2})
iex> CookieJar.to_string(jar)
"a=1; b=2"
@spec put_new(GenServer.server(), CookieJar.Cookie.t() | {term(), term()}) :: :ok

Put new cookie into a cookie jar

examples

Examples

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put_new(jar, {"a", 3})
iex> CookieJar.to_string(jar)
"a=1"

See CookieJar.stop/1.

@spec start_link(keyword()) :: GenServer.on_start()

Create a new cookie jar

examples

Examples

CookieJar.start_link
# or
CookieJar.new
@spec stop(GenServer.server()) :: :ok

Destroy a cookie jar

examples

Examples

CookieJar.stop(jar)
# or
CookieJar.smash(jar)

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.stop(jar)
iex> Process.alive?(jar)
false
@spec to_string(GenServer.server()) :: String.t()

Get the cookies in Cookie format

examples

Examples

CookieJar.to_string(jar)
# or
CookieJar.label(jar)

iex> {:ok, jar} = CookieJar.new
iex> CookieJar.to_string(jar)
""
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put(jar, {"b", 2})
iex> CookieJar.to_string(jar)
"a=1; b=2"
@spec to_string(GenServer.server(), String.t()) :: String.t()

Get the cookies in Cookie format for the given URI