Pixelex.Plug.Cookies (Pixelex v0.1.0)

Copy Markdown View Source

Read a cookie without caring whether the host fetched them.

conn.cookies is %Plug.Conn.Unfetched{} until fetch_cookies/2 runs, and indexing that raises. is_map/1 does not save you: Unfetched is a struct and structs are maps.

That combination cost this library a silent outage in testing — every request raised inside a rescue, the rescue swallowed it, and the app recorded nothing at all while looking completely healthy. An endpoint that never calls fetch_cookies/2 is perfectly ordinary, so this has to be safe.

Summary

Functions

The consent decision the host's banner recorded, from assigns or the cookie.

The cookie's value, or nil — including when cookies were never fetched.

Functions

get(arg1, name)

@spec get(Plug.Conn.t(), String.t()) :: String.t() | nil

The cookie's value, or nil — including when cookies were never fetched.