¤ stdResponse

HTTP related types

Types

stdResponse :: Int -> String -> HttpHeaders -> String -> HttpResponse

Synopsis

stdResponse code message headers contents

Description

stdResponse is a general function for constructing HTTP responses.

Arguments

code :: Int
The status code, e.g., 200 for a normal response.
message :: String
A short message to explain the status code.
headers :: HttpHeaders
HTTP headers to be included in the response. At least the Mime type of the contents should be included here. (You can use contentType or htmlType to generate the appropriate header.)
contents :: String
The contents of the response. The type of the contents should agree with the Mime type given in the headers.

See Also

Easier ways to construct common responses: okResponse, okResponse', htmlType, contentType.

The HTTP response type in all detail: HttpResponse.

The HTTP protocol (e.g., explanation of status codes): Hypertext Transfer Protocol -- HTTP/1.0.