Skip to content

Cookies and Safe

Compare
Choose a tag to compare
@grych grych released this 10 Aug 07:05
· 47 commits to master since this release

This is a slow evolution release, containing a number of bug fixes and a few new features:

  • Cookies function in Drab.Browser
iex> set_cookie(socket, "mycookie", "value", max_age: 10)
{:ok, "mycookie=value; expires=Thu, 19 Jul 2018 19:47:09 GMT"}


iex> Drab.Browser.cookies(socket, decoder: Drab.Coder.Cipher)
{:ok, %{"other" => 42, "mycookie" => "value"}}
  • Drab.{Live, Core, Element, Modal} functions accept %Phoenix.HTML.Safe{}

That means you don't need to call safe_to_string/1 anymore, just pass the safe:

html = ~E"<strong><%= nick %>:</strong> <%= message %><br>"
broadcast_insert socket, "#chat", :beforeend, html
  • Tested with Elixir 1.7

Drab is now blessed to work with Elixir 1.7 and OTP 21.