]> gitweb @ CieloNegro.org - Lucu.git/blob - Network/HTTP/Lucu/Response.hs
Initial Import
[Lucu.git] / Network / HTTP / Lucu / Response.hs
1 module Network.HTTP.Lucu.Response
2     ( StatusCode(..)
3     , Response(..)
4     )
5     where
6
7 import qualified Data.ByteString.Lazy.Char8 as B
8 import           Data.ByteString.Lazy.Char8 (ByteString)
9 import           Network.HTTP.Lucu.Headers
10 import           Network.HTTP.Lucu.HttpVersion
11
12 data StatusCode = Continue
13                 | SwitchingProtocols
14                 | Processing
15                 -- 
16                 | Ok
17                 | Created
18                 | Accepted
19                 | NonAuthoritativeInformation
20                 | NoContent
21                 | ResetContent
22                 | PartialContent
23                 | MultiStatus
24                 --
25                 | MultipleChoices
26                 | MovedPermanently
27                 | Found
28                 | SeeOther
29                 | NotModified
30                 | UseProxy
31                 | TemporaryRedirect
32                 --
33                 | BadRequest
34                 | Unauthorized
35                 | PaymentRequired
36                 | Forbidden
37                 | NotFound
38                 | MethodNotAllowed
39                 | NotAcceptable
40                 | ProxyAuthenticationRequired
41                 | RequestTimeout
42                 | Conflict
43                 | Gone
44                 | LengthRequired
45                 | PreconditionFailed
46                 | RequestEntityTooLarge
47                 | RequestURITooLarge
48                 | UnsupportedMediaType
49                 | RequestRangeNotSatisfiable
50                 | ExpectationFailed
51                 | UnprocessableEntitiy
52                 | Locked
53                 | FailedDependency
54                 --
55                 | InternalServerError
56                 | NotImplemented
57                 | BadGateway
58                 | ServiceUnavailable
59                 | GatewayTimeout
60                 | HttpVersionNotSupported
61                 | InsufficientStorage
62
63 data Response = Response {
64       resVersion :: HttpVersion
65     , resStatus  :: StatusCode
66     , resHeaders :: Headers
67     , resBody    :: Maybe ByteString
68     }
69
70 instance HasHeaders Response where
71     getHeaders = resHeaders
72     setHeaders res hdr = res { resHeaders = hdr }