1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {-# LANGUAGE OverloadedStrings #-}
module Cookie
( setCookie,
) where
import Web.Scotty
import Web.Cookie
import Data.Text
import Data.Text.Encoding
import qualified Data.Text.Lazy.Encoding as Lazy
import Data.ByteString.Builder
setCookie :: Text -> Text -> ActionM ()
setCookie name value = addHeader "Set-Cookie" (Lazy.decodeUtf8 $ toLazyByteString $ renderSetCookie $ defaultSetCookie { setCookieName = encodeUtf8 name, setCookieValue = encodeUtf8 value })
|