EllaSource codeContentsIndex
Ella.Response
Contents
Response object
Building Response objects
Starting points for Response objects
Using Response objects
Synopsis
data Response
content :: Response -> ByteString
headers :: Response -> Headers
status :: Response -> Int
cookies :: Response -> [Cookie]
newtype HeaderName = HeaderName String
Cookie
buildResponse :: [Response -> Response] -> Response -> Response
addContent :: ByteString -> Response -> Response
setStatus :: Int -> Response -> Response
setHeader :: String -> String -> Response -> Response
addCookie :: Cookie -> Response -> Response
deleteCookie :: String -> Response -> Response
standardCookie
expireCookie
textResponse :: String -> Response
utf8TextResponse :: Response
htmlResponse :: String -> Response
utf8HtmlResponse :: Response
emptyResponse :: Response
redirectResponse :: String -> Response
formatResponse :: Response -> ByteString
Response object
data Response Source
Represents an HTTP response
show/hide Instances
content :: Response -> ByteStringSource
The body of the response
headers :: Response -> HeadersSource
The HTTP headers of the response
status :: Response -> IntSource
HTTP status code
cookies :: Response -> [Cookie]Source
Cookies to be set. Uses Cookie from Network.CGI.Cookie
newtype HeaderName Source
A string with case insensitive equality and comparisons.
Constructors
HeaderName String
show/hide Instances
Cookie
Building Response objects
buildResponse :: [Response -> Response] -> Response -> ResponseSource

Build a Response from a list of Response transformation functions and an initial Response.

This is a convenient way of creating responses:

 resp = buildResponse [ setHeader "Location" foo
                      , setStatus 302
                      ] utf8HtmlResponse
addContent :: ByteString -> Response -> ResponseSource
Add a string to a response
setStatus :: Int -> Response -> ResponseSource
Set the HTTP status code of a response
setHeader :: String -> String -> Response -> ResponseSource
Set an HTTP header. Previous values (if present) will be overwritten
addCookie :: Cookie -> Response -> ResponseSource
Add cookie to a response. Cookie structure is from Network.CGI.Cookie
deleteCookie :: String -> Response -> ResponseSource
Delete the named cookie in the client
standardCookie
expireCookie
Starting points for Response objects
textResponse :: String -> ResponseSource
An empty text/plain response of a given charset
utf8TextResponse :: ResponseSource
An empty UTF8 text/plain response. The user is responsible for ensuring that that content added to this response is actually UTF8 ByteStrings.
htmlResponse :: String -> ResponseSource
An empty text/html response of a given charset
utf8HtmlResponse :: ResponseSource
An empty UTF8 text/html response. The user is responsible for ensuring that that content added to this response is actually UTF8 ByteStrings.
emptyResponse :: ResponseSource
A basic, empty 200 OK response
redirectResponse :: String -> ResponseSource
Create an HTTP 302 redirect
Using Response objects
formatResponse :: Response -> ByteStringSource

Convert a Response into the format needed for HTTP.

Copied from Network.CGI.Protocol, thank you Bjorn Bringert :-)

Produced by Haddock version 2.4.2