module IHP.Controller.Cookie (setCookie) where
import IHP.Prelude
import IHP.ControllerSupport
import Web.Cookie
import qualified Data.Binary.Builder as Binary
import qualified Data.ByteString.Lazy as LBS
setCookie :: (?context :: ControllerContext) => SetCookie -> IO ()
setCookie :: (?context::ControllerContext) => SetCookie -> IO ()
setCookie SetCookie
cookie = (?context::ControllerContext) => Header -> IO ()
Header -> IO ()
setHeader (HeaderName
"Set-Cookie", ByteString
cookieString)
where
cookieString :: ByteString
cookieString = SetCookie
cookie
SetCookie -> (SetCookie -> Builder) -> Builder
forall {t1} {t2}. t1 -> (t1 -> t2) -> t2
|> SetCookie -> Builder
renderSetCookie
Builder -> (Builder -> LazyByteString) -> LazyByteString
forall {t1} {t2}. t1 -> (t1 -> t2) -> t2
|> Builder -> LazyByteString
Binary.toLazyByteString
LazyByteString -> (LazyByteString -> ByteString) -> ByteString
forall {t1} {t2}. t1 -> (t1 -> t2) -> t2
|> LazyByteString -> ByteString
LBS.toStrict