Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
This module defines some convenience functions for creating responses.
Synopsis
- ok :: ContentType -> ByteString -> Response
- okHtml :: ByteString -> Response
- okJson :: ByteString -> Response
- okXml :: ByteString -> Response
- movedTo :: String -> Response
- redirectTo :: ByteString -> Response
- badRequest :: Response
- requireBasicAuth :: String -> Response
- forbidden :: Response
- notFound :: Response
- serverError :: ByteString -> Response
Documentation
ok :: ContentType -> ByteString -> Response Source #
Creates a 200 (OK) Response
with the given content-type and resposne
body
okHtml :: ByteString -> Response Source #
Creates a 200 (OK) Response
with content-type "text/html" and the
given resposne body
okJson :: ByteString -> Response Source #
Creates a 200 (OK) Response
with content-type "application/json" and the
given resposne body
okXml :: ByteString -> Response Source #
Creates a 200 (OK) Response
with content-type "application/xml" and the
given resposne body
movedTo :: String -> Response Source #
Given a URL returns a 301 (Moved Permanently) Response
redirecting to
that URL.
redirectTo :: ByteString -> Response Source #
Given a URL returns a 303 (See Other) Response
redirecting to that URL.
badRequest :: Response Source #
Returns a 400 (Bad Request) Response
.
requireBasicAuth :: String -> Response Source #
Returns a 401 (Authorization Required) Response
requiring basic
authentication in the given realm.
serverError :: ByteString -> Response Source #
Returns a 500 (Server Error) Response
.