Safe Haskell | None |
---|---|
Language | Haskell2010 |
Airship.Helpers
- parseFormData :: Request -> IO ([Param], [File ByteString])
- contentTypeMatches :: Monad m => [MediaType] -> Webmachine m Bool
- redirectTemporarily :: Monad m => ByteString -> Webmachine m a
- redirectPermanently :: Monad m => ByteString -> Webmachine m a
- resourceToWai :: AirshipConfig -> RoutingSpec IO () -> ErrorResponses IO -> Application
- resourceToWaiT :: Monad m => AirshipConfig -> (Request -> m Response -> IO Response) -> RoutingSpec m () -> ErrorResponses m -> Application
- appendRequestPath :: Monad m => [Text] -> Webmachine m ByteString
- lookupParam :: Monad m => Text -> Webmachine m Text
- lookupParam' :: Monad m => Text -> Webmachine m (Maybe Text)
Documentation
parseFormData :: Request -> IO ([Param], [File ByteString]) #
Parse form data uploaded with a Content-Type
of either
www-form-urlencoded
or multipart/form-data
to return a
list of parameter names and values and a list of uploaded
files and their information.
contentTypeMatches :: Monad m => [MediaType] -> Webmachine m Bool #
Returns True
if the request's Content-Type
header is one of the
provided media types. If the Content-Type
header is not present,
this function will return True.
redirectTemporarily :: Monad m => ByteString -> Webmachine m a #
Issue an HTTP 302 (Found) response, with location
as the destination.
redirectPermanently :: Monad m => ByteString -> Webmachine m a #
Issue an HTTP 301 (Moved Permantently) response,
with location
as the destination.
resourceToWai :: AirshipConfig -> RoutingSpec IO () -> ErrorResponses IO -> Application #
Given a RoutingSpec
, a 404 resource, and a user state s
, construct a WAI Application
.
resourceToWaiT :: Monad m => AirshipConfig -> (Request -> m Response -> IO Response) -> RoutingSpec m () -> ErrorResponses m -> Application #
Given a RoutingSpec
, an ErrorResponses
, and a user state s
, construct a WAI Application
.
appendRequestPath :: Monad m => [Text] -> Webmachine m ByteString #
lookupParam :: Monad m => Text -> Webmachine m Text #
Lookup routing parameter and return 500 Internal Server Error if not found. Not finding the paramter usually means the route doesn't match what the resource is expecting.
lookupParam' :: Monad m => Text -> Webmachine m (Maybe Text) #
Lookup routing parameter.