Safe Haskell | None |
---|---|
Language | Haskell2010 |
- 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 -> (AirshipRequest -> m Response -> IO Response) -> RoutingSpec m () -> ErrorResponses m -> Application
- resourceToWaiT' :: Monad m => AirshipConfig -> (AirshipRequest -> m Response -> IO Response) -> Trie (RouteLeaf 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]) Source #
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 Source #
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 Source #
Issue an HTTP 302 (Found) response, with location
as the destination.
redirectPermanently :: Monad m => ByteString -> Webmachine m a Source #
Issue an HTTP 301 (Moved Permantently) response,
with location
as the destination.
resourceToWai :: AirshipConfig -> RoutingSpec IO () -> ErrorResponses IO -> Application Source #
Given a RoutingSpec
, a 404 resource, and a user state s
, construct a WAI Application
.
resourceToWaiT :: Monad m => AirshipConfig -> (AirshipRequest -> m Response -> IO Response) -> RoutingSpec m () -> ErrorResponses m -> Application Source #
Given a 'AirshipConfig, a function to modify the Response
based on the
AirshipRequest
and the Response
(like WAI middleware), a 'RoutingSpec,
and ErrorResponses
construct a WAI Application
.
resourceToWaiT' :: Monad m => AirshipConfig -> (AirshipRequest -> m Response -> IO Response) -> Trie (RouteLeaf m) -> ErrorResponses m -> Application Source #
Like resourceToWaiT
, but expects the RoutingSpec
to have been
evaluated with runRouter
. This is more efficient than resourceToWaiT
, as
the routes will not be evaluated on every request.
Given routes :: RoutingSpec IO ()
, resourceToWaiT'
can be invoked like so:
resourceToWaiT' cfg (const id) (runRouter routes) errors
appendRequestPath :: Monad m => [Text] -> Webmachine m ByteString Source #
lookupParam :: Monad m => Text -> Webmachine m Text Source #
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) Source #
Lookup routing parameter.