blob: dc9cbc4a39a4cca6b1cfa58b5236f65d58339323 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
module Controller.Helper
( okOrBadRequest
) where
import Data.Text (Text)
import qualified Data.Text.Lazy as LT
import qualified Network.HTTP.Types.Status as Status
import Web.Scotty (ActionM)
import qualified Web.Scotty as S
okOrBadRequest :: Either Text () -> ActionM ()
okOrBadRequest (Left message) = do
S.status Status.badRequest400
S.text (LT.fromStrict message)
okOrBadRequest (Right ()) =
S.status Status.ok200
|