airship- A Webmachine-inspired HTTP library

Safe HaskellNone




data Request :: *

Information on the request sent by the client. This abstracts away the details of the underlying implementation.


defaultRequest :: Request

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.

escapedResponse :: Text -> ResponseBody Source

Helper function for building a ResponseBuilder out of HTML-escaped text.

request :: Handler m Request Source

Returns the Request that this Handler is currently processing.

requestTime :: Handler m UTCTime Source

Returns the time at which this request began processing.

getResponseHeaders :: Handler m ResponseHeaders Source

Returns the ResponseHeaders stored in the current Handler.

getResponseBody :: Handler m ResponseBody Source

Returns the current ResponseBody that this Handler is storing.

params :: Handler m (HashMap Text Text) Source

Returns the bound routing parameters extracted from the routing system (see Airship.Route).

dispatchPath :: Handler m [Text] Source

putResponseBody :: ResponseBody -> Handler 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.

(#>) :: MonadWriter [(k, v)] m => k -> v -> m () Source

The #> operator provides syntactic sugar for the construction of association lists. For example, the following assoc list:

    [("run", "jewels"), ("blue", "suede"), ("zion", "wolf")]

can be represented as such:

    execWriter $ do
      "run" #> "jewels"
      "blue" #> "suede"
      "zion" #> "wolf"

It used in RoutingSpec declarations to indicate that a particular Route maps to a given Resource, but can be used in many other places where association lists are expected, such as contentTypesProvided.