git.iko.soy/ikoHSE/sc-lectures
on master help sign in
Yet another update
94418b2iko
l5/src/Server.hs−6
@@ -8,7 +8,6 @@ import qualified Data.ByteString.Lazy.Char8 as BSLC
8import Data.List
8import Data.List
9import qualified Data.Map as M
9import qualified Data.Map as M
10import Data.Text (Text)
10import Data.Text (Text)
11−import Debug.Trace
12import Handlers
11import Handlers
13import Network.HTTP.Types.Method
12import Network.HTTP.Types.Method
14import Network.HTTP.Types.Status
13import Network.HTTP.Types.Status
@@ -57,15 +56,10 @@ runAuthHandler ::
57runAuthHandler f req = do
56runAuthHandler f req = do
58 let authCookie =
57 let authCookie =
59 fmap snd
58 fmap snd
60− . traceShowId
61 . find ((==) authCookieNameBS . fst)
59 . find ((==) authCookieNameBS . fst)
62− . traceShowId
63 . mconcat
60 . mconcat
64− . traceShowId
65 . fmap (parseCookies . snd)
61 . fmap (parseCookies . snd)
66− . traceShowId
67 . filter ((==) "Cookie" . fst)
62 . filter ((==) "Cookie" . fst)
68− . traceShowId
69 $ requestHeaders req
63 $ requestHeaders req
70 decodedCookie = authCookie >>= either (const Nothing) Just . decodeCookie
64 decodedCookie = authCookie >>= either (const Nothing) Just . decodeCookie
71 cookiesTVar <- asks cookies
65 cookiesTVar <- asks cookies
l5/src/Types/Server.hs+1−1
@@ -102,7 +102,7 @@ class ServerError e where
102 serverErrorStatus _ = status422
102 serverErrorStatus _ = status422
103
103
104throwServerError ::
104throwServerError ::
105− (MonadError (ServerResponse ByteString) m, ServerError e, Show e) =>
105+ (MonadError ResponseError m, ServerError e, Show e) =>
106 e ->
106 e ->
107 m a
107 m a
108throwServerError e =
108throwServerError e =