simple-0.7.0.1: A minimalist web framework for the WAI server interface

Safe HaskellNone

Web.Simple.Responses

Description

This module defines some convenience functions for creating responses.

Synopsis

Documentation

ok :: ContentType -> ByteString -> ResponseSource

Creates a 200 (OK) Response with the given content-type and resposne body

okHtml :: ByteString -> ResponseSource

Creates a 200 (OK) Response with content-type "text/html" and the given resposne body

okJson :: ByteString -> ResponseSource

Creates a 200 (OK) Response with content-type "application/json" and the given resposne body

movedTo :: String -> ResponseSource

Given a URL returns a 301 (Moved Permanently) Response redirecting to that URL.

redirectTo :: ByteString -> ResponseSource

Given a URL returns a 303 (See Other) Response redirecting to that URL.

badRequest :: ResponseSource

Returns a 400 (Bad Request) Response.

requireBasicAuth :: String -> ResponseSource

Returns a 401 (Authorization Required) Response requiring basic authentication in the given realm.

forbidden :: ResponseSource

Returns a 403 (Forbidden) Response.

notFound :: ResponseSource

Returns a 404 (Not Found) Response.

serverError :: ByteString -> ResponseSource

Returns a 500 (Server Error) Response.