Network.HTTP.Lucu.Response.StatusCode
Description
Definition of HTTP status codes.
- class (Eq sc, Show sc) => StatusCode sc where
- numericCode :: sc -> Int
- textualStatus :: sc -> AsciiBuilder
- fromStatusCode :: sc -> SomeStatusCode
- data SomeStatusCode
- statusCodes :: QuasiQuoter
- data Continue = Continue
- data SwitchingProtocols = SwitchingProtocols
- data Processing = Processing
- data OK = OK
- data Created = Created
- data Accepted = Accepted
- data NonAuthoritativeInformation = NonAuthoritativeInformation
- data NoContent = NoContent
- data ResetContent = ResetContent
- data PartialContent = PartialContent
- data MultiStatus = MultiStatus
- data AlreadyReported = AlreadyReported
- data IMUsed = IMUsed
- data MultipleChoices = MultipleChoices
- data MovedPermanently = MovedPermanently
- data Found = Found
- data SeeOther = SeeOther
- data NotModified = NotModified
- data UseProxy = UseProxy
- data TemporaryRedirect = TemporaryRedirect
- data BadRequest = BadRequest
- data Unauthorized = Unauthorized
- data PaymentRequired = PaymentRequired
- data Forbidden = Forbidden
- data NotFound = NotFound
- data MethodNotAllowed = MethodNotAllowed
- data NotAcceptable = NotAcceptable
- data ProxyAuthenticationRequired = ProxyAuthenticationRequired
- data RequestTimeout = RequestTimeout
- data Conflict = Conflict
- data Gone = Gone
- data LengthRequired = LengthRequired
- data PreconditionFailed = PreconditionFailed
- data RequestEntityTooLarge = RequestEntityTooLarge
- data RequestURITooLarge = RequestURITooLarge
- data UnsupportedMediaType = UnsupportedMediaType
- data RequestRangeNotSatisfiable = RequestRangeNotSatisfiable
- data ExpectationFailed = ExpectationFailed
- data UnprocessableEntity = UnprocessableEntity
- data Locked = Locked
- data FailedDependency = FailedDependency
- data UpgradeRequired = UpgradeRequired
- data InternalServerError = InternalServerError
- data NotImplemented = NotImplemented
- data BadGateway = BadGateway
- data ServiceUnavailable = ServiceUnavailable
- data GatewayTimeout = GatewayTimeout
- data HTTPVersionNotSupported = HTTPVersionNotSupported
- data VariantAlsoNegotiates = VariantAlsoNegotiates
- data InsufficientStorage = InsufficientStorage
- data LoopDetected = LoopDetected
- data NotExtended = NotExtended
Type class
class (Eq sc, Show sc) => StatusCode sc whereSource
Type class for HTTP status codes.
Declaring types for each statuses is surely a pain. See:
statusCodes quasi-quoter.
Minimal complete definition: numericCode and textualStatus.
Methods
numericCode :: sc -> IntSource
Return the 3-digit integer for this status e.g. 200
textualStatus :: sc -> AsciiBuilderSource
Return the combination of 3-digit integer and reason phrase
for this status e.g. 200 OK
fromStatusCode :: sc -> SomeStatusCodeSource
Wrap the status code into SomeStatusCode.
Instances
data SomeStatusCode Source
Container type for the StatusCode type class.
Instances
| Eq SomeStatusCode | Equivalence of |
| Show SomeStatusCode | |
| StatusCode SomeStatusCode | |
| StatusCode sc => ConvertSuccess sc SomeStatusCode | |
| StatusCode sc => ConvertAttempt sc SomeStatusCode |
statusCodes :: QuasiQuoterSource
QuasiQuoter for StatusCode declarations.
Top-level splicing
[statusCodes|
200 OK
400 Bad Request
405 Method Not Allowed
|]
becomes:
data OK = OK deriving (Eq,Show) instanceStatusCodeOK wherenumericCode_ = 200textualStatus_ =cs("200 OK" Ascii) data BadRequest = BadRequest deriving (Eq,Show) instanceStatusCodeBadRequest wherenumericCode_ = 400textualStatus_ =cs("400 Bad Request" Ascii) data MethodNotAllowed = MethodNotAllowed deriving (Eq,Show) instanceStatusCodeMethodNotAllowed wherenumericCode_ = 405textualStatus_ =cs("405 Method Not Allowed" Ascii)
Status codes
Informational
data SwitchingProtocols Source
Constructors
| SwitchingProtocols |
Successful
data NonAuthoritativeInformation Source
Constructors
| NonAuthoritativeInformation |
Constructors
| NoContent |
data PartialContent Source
Constructors
| PartialContent |
data AlreadyReported Source
Constructors
| AlreadyReported |
Redirection
data MultipleChoices Source
Constructors
| MultipleChoices |
data MovedPermanently Source
Constructors
| MovedPermanently |
data TemporaryRedirect Source
Constructors
| TemporaryRedirect |
Client Error
data PaymentRequired Source
Constructors
| PaymentRequired |
Constructors
| Forbidden |
data MethodNotAllowed Source
Constructors
| MethodNotAllowed |
data ProxyAuthenticationRequired Source
Constructors
| ProxyAuthenticationRequired |
data RequestTimeout Source
Constructors
| RequestTimeout |
data LengthRequired Source
Constructors
| LengthRequired |
data PreconditionFailed Source
Constructors
| PreconditionFailed |
data RequestEntityTooLarge Source
Constructors
| RequestEntityTooLarge |
data RequestURITooLarge Source
Constructors
| RequestURITooLarge |
data UnsupportedMediaType Source
Constructors
| UnsupportedMediaType |
data RequestRangeNotSatisfiable Source
Constructors
| RequestRangeNotSatisfiable |
data ExpectationFailed Source
Constructors
| ExpectationFailed |
data UnprocessableEntity Source
Constructors
| UnprocessableEntity |
data FailedDependency Source
Constructors
| FailedDependency |
data UpgradeRequired Source
Constructors
| UpgradeRequired |
Server Error
data InternalServerError Source
Constructors
| InternalServerError |
data NotImplemented Source
Constructors
| NotImplemented |
data GatewayTimeout Source
Constructors
| GatewayTimeout |
data HTTPVersionNotSupported Source
Constructors
| HTTPVersionNotSupported |
data VariantAlsoNegotiates Source
Constructors
| VariantAlsoNegotiates |
data InsufficientStorage Source
Constructors
| InsufficientStorage |