module IHP.Controller.RequestContext
( RequestContext (..)
, Respond
, RequestBody (..)
) where
import ClassyPrelude
import qualified Data.ByteString.Lazy as LBS
import Network.Wai (Request, Response, ResponseReceived)
import Network.Wai.Parse (File, Param)
import IHP.FrameworkConfig
import qualified Data.Aeson as Aeson
type Respond = Response -> IO ResponseReceived
data RequestBody
= FormBody { RequestBody -> [Param]
params :: [Param], RequestBody -> [File ByteString]
files :: [File LBS.ByteString] }
| JSONBody { RequestBody -> Maybe Value
jsonPayload :: Maybe Aeson.Value, RequestBody -> ByteString
rawPayload :: LByteString }
data RequestContext = RequestContext
{ RequestContext -> Request
request :: Request
, RequestContext -> Respond
respond :: Respond
, RequestContext -> RequestBody
requestBody :: RequestBody
, RequestContext -> FrameworkConfig
frameworkConfig :: FrameworkConfig
}