-
-
Save blueonyx/f6cb38b965252a928cf2 to your computer and use it in GitHub Desktop.
when i "runhaskell BigSession.hs" i don't get the recv error message of "yesod devel" but sometimes a Nothing from "lookupSession": If you clear cookies, go to /start/3000 you get Nothing.
If you clear cookies, go to /start/2500 you get 2500.
If you go to /start/3000 afterwards you still get 2500.
So "clearSession" seems not to not always work c…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, | |
TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
import Data.Text (Text,unpack,pack) | |
data BigSession = BigSession | |
mkYesod "BigSession" [parseRoutes| | |
/start/#Int StartR GET | |
/error ErrorR GET | |
|] | |
instance Yesod BigSession | |
getStartR :: Int -> Handler RepHtml | |
getStartR size = do | |
clearSession | |
setSession "error" $ pack $ take size $ repeat '1' | |
redirect ErrorR | |
getErrorR :: Handler RepHtml | |
getErrorR = do | |
x <- lookupSession "error" | |
let x' = case x of | |
Nothing -> "Nothing" | |
Just y -> show $ length $ unpack y | |
defaultLayout $ [whamlet|#{x'}<br> | |
<a href=@{StartR 2500}>start 2500 | |
<a href=@{StartR 3000}>start 3000 | |
|] | |
main :: IO () | |
main = warpDebug 3000 BigSession |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment