airship-0.9.2: A Webmachine-inspired HTTP library

Safe HaskellNone
LanguageHaskell2010

Airship.Resource

Synopsis

Documentation

data Resource m Source #

Constructors

Resource 

Fields

data PostResponse m Source #

Used when processing POST requests so as to handle the outcome of the binary decisions between handling a POST as a create request and whether to redirect after the POST is done. Credit for this idea goes to Richard Wallace (purefn) on Webcrank.

For processing the POST, an association list of MediaTypes and Webmachine actions are required that correspond to the accepted Content-Type values that this resource can accept in a request body. If a Content-Type header is present but not accounted for, processing will halt with 415 Unsupported Media Type.

Constructors

PostCreate [Text]

Treat this request as a PUT.

PostCreateRedirect [Text]

Treat this request as a PUT, then redirect.

PostProcess [(MediaType, Webmachine m ())]

Process as a POST, but don't redirect.

PostProcessRedirect [(MediaType, Webmachine m ByteString)]

Process and redirect.

serverError :: Monad m => Webmachine m a Source #

A helper function that terminates execution with 500 Internal Server Error.

defaultResource :: Monad m => Resource m Source #

The default Airship resource, with "sensible" values filled in for each entry. You construct new resources by extending the default resource with your own handlers.