Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data ETag
- data Webmachine m a
- data AirshipRequest = AirshipRequest {
- _request :: Request
- _routePath :: Text
- data Request :: *
- data RequestReader = RequestReader {}
- data Response = Response {}
- data ResponseState = ResponseState {
- stateHeaders :: ResponseHeaders
- stateBody :: ResponseBody
- _params :: HashMap Text Text
- _dispatchPath :: [Text]
- decisionTrace :: Trace
- data ResponseBody
- type ErrorResponses m = Monad m => Map Status [(MediaType, Webmachine m ResponseBody)]
- addTrace :: Monad m => ByteString -> Webmachine m ()
- defaultRequest :: Request
- entireRequestBody :: MonadIO m => Request -> m ByteString
- etagToByteString :: ETag -> ByteString
- eitherResponse :: Monad m => RequestReader -> ResponseState -> Webmachine m Response -> m (Response, Trace)
- escapedResponse :: Text -> ResponseBody
- mapWebmachine :: (m1 (Either Response a1, ResponseState) -> m2 (Either Response a2, ResponseState)) -> Webmachine m1 a1 -> Webmachine m2 a2
- runWebmachine :: Monad m => RequestReader -> ResponseState -> Webmachine m a -> m (Either Response a, Trace)
- request :: Monad m => Webmachine m Request
- requestTime :: Monad m => Webmachine m UTCTime
- routePath :: Monad m => Webmachine m Text
- getResponseHeaders :: Monad m => Webmachine m ResponseHeaders
- getResponseBody :: Monad m => Webmachine m ResponseBody
- params :: Monad m => Webmachine m (HashMap Text Text)
- dispatchPath :: Monad m => Webmachine m [Text]
- putResponseBody :: Monad m => ResponseBody -> Webmachine m ()
- putResponseBS :: Monad m => ByteString -> Webmachine m ()
- halt :: Monad m => Status -> Webmachine m a
- finishWith :: Monad m => Response -> Webmachine m a
Documentation
data Webmachine m a Source #
MonadTrans Webmachine Source # | |
MonadBase b m => MonadBase b (Webmachine m) Source # | |
MonadBaseControl b m => MonadBaseControl b (Webmachine m) Source # | |
Monad m => MonadState ResponseState (Webmachine m) Source # | |
Monad m => MonadReader RequestReader (Webmachine m) Source # | |
Monad m => Monad (Webmachine m) Source # | |
Functor m => Functor (Webmachine m) Source # | |
Monad m => Applicative (Webmachine m) Source # | |
MonadIO m => MonadIO (Webmachine m) Source # | |
type StM (Webmachine m) a Source # | |
data AirshipRequest Source #
Information on the request sent by the client. This abstracts away the details of the underlying implementation.
data RequestReader Source #
Monad m => MonadReader RequestReader (Webmachine m) Source # | |
data ResponseState Source #
ResponseState | |
|
Monad m => MonadState ResponseState (Webmachine m) Source # | |
data ResponseBody Source #
Basically Wai's unexported Response
type.
type ErrorResponses m = Monad m => Map Status [(MediaType, Webmachine m ResponseBody)] Source #
addTrace :: Monad m => ByteString -> Webmachine m () Source #
Adds the provided ByteString to the Airship-Trace header.
A default, blank request.
Since 2.0.0
entireRequestBody :: MonadIO m => Request -> m ByteString Source #
Reads the entirety of the request body in a single string.
This turns the chunks obtained from repeated invocations of requestBody
into a lazy ByteString
.
etagToByteString :: ETag -> ByteString Source #
eitherResponse :: Monad m => RequestReader -> ResponseState -> Webmachine m Response -> m (Response, Trace) Source #
escapedResponse :: Text -> ResponseBody Source #
Helper function for building a ResponseBuilder
out of HTML-escaped text.
mapWebmachine :: (m1 (Either Response a1, ResponseState) -> m2 (Either Response a2, ResponseState)) -> Webmachine m1 a1 -> Webmachine m2 a2 Source #
Map both the return value and wrapped computation m
.
runWebmachine :: Monad m => RequestReader -> ResponseState -> Webmachine m a -> m (Either Response a, Trace) Source #
request :: Monad m => Webmachine m Request Source #
Returns the Request
that is currently being processed.
requestTime :: Monad m => Webmachine m UTCTime Source #
Returns the time at which this request began processing.
routePath :: Monad m => Webmachine m Text Source #
Returns the route path that was matched during route evaluation. This is
not the path specified in the request, but rather the route in the
RoutingSpec
that matched the request URL. Variables names are prefixed
with :
, and free ("star") paths are designated with *
.
getResponseHeaders :: Monad m => Webmachine m ResponseHeaders Source #
Returns the current ResponseHeaders
.
getResponseBody :: Monad m => Webmachine m ResponseBody Source #
Returns the current ResponseBody
.
params :: Monad m => Webmachine m (HashMap Text Text) Source #
Returns the bound routing parameters extracted from the routing system (see Airship.Route).
dispatchPath :: Monad m => Webmachine m [Text] Source #
putResponseBody :: Monad m => ResponseBody -> Webmachine m () Source #
Given a new ResponseBody
, replaces the stored body with the new one.
putResponseBS :: Monad m => ByteString -> Webmachine m () Source #
Stores the provided ByteString
as the responseBody. This is a shortcut for
creating a response body with a ResponseBuilder
and a bytestring Builder
.
halt :: Monad m => Status -> Webmachine m a Source #
Immediately halts processing with the provided Status
code.
The contents of the Webmachine'
s response body will be streamed back to the client.
This is a shortcut for constructing a Response
with getResponseHeaders
and getResponseBody
and passing that response to finishWith
.
finishWith :: Monad m => Response -> Webmachine m a Source #
Immediately halts processing and writes the provided Response
back to the client.