{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
module Network.HTTP.Types.Status
( Status(..)
, mkStatus
, status100
, continue100
, status101
, switchingProtocols101
, status200
, ok200
, status201
, created201
, status202
, accepted202
, status203
, nonAuthoritative203
, status204
, noContent204
, status205
, resetContent205
, status206
, partialContent206
, status300
, multipleChoices300
, status301
, movedPermanently301
, status302
, found302
, status303
, seeOther303
, status304
, notModified304
, status305
, useProxy305
, status307
, temporaryRedirect307
, status308
, permanentRedirect308
, status400
, badRequest400
, status401
, unauthorized401
, status402
, paymentRequired402
, status403
, forbidden403
, status404
, notFound404
, status405
, methodNotAllowed405
, status406
, notAcceptable406
, status407
, proxyAuthenticationRequired407
, status408
, requestTimeout408
, status409
, conflict409
, status410
, gone410
, status411
, lengthRequired411
, status412
, preconditionFailed412
, status413
, requestEntityTooLarge413
, status414
, requestURITooLong414
, status415
, unsupportedMediaType415
, status416
, requestedRangeNotSatisfiable416
, status417
, expectationFailed417
, status418
, imATeapot418
, status422
, unprocessableEntity422
, status426
, upgradeRequired426
, status428
, preconditionRequired428
, status429
, tooManyRequests429
, status431
, requestHeaderFieldsTooLarge431
, status500
, internalServerError500
, status501
, notImplemented501
, status502
, badGateway502
, status503
, serviceUnavailable503
, status504
, gatewayTimeout504
, status505
, status511
, networkAuthenticationRequired511
, httpVersionNotSupported505
, statusIsInformational
, statusIsSuccessful
, statusIsRedirection
, statusIsClientError
, statusIsServerError
) where
import qualified Data.ByteString as B
import Data.Typeable
data Status
= Status { Status -> Int
statusCode :: Int
, Status -> ByteString
statusMessage :: B.ByteString
} deriving (Int -> Status -> ShowS
[Status] -> ShowS
Status -> String
(Int -> Status -> ShowS)
-> (Status -> String) -> ([Status] -> ShowS) -> Show Status
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Status] -> ShowS
$cshowList :: [Status] -> ShowS
show :: Status -> String
$cshow :: Status -> String
showsPrec :: Int -> Status -> ShowS
$cshowsPrec :: Int -> Status -> ShowS
Show, Typeable)
instance Eq Status where
Status { statusCode :: Status -> Int
statusCode = Int
a } == :: Status -> Status -> Bool
== Status { statusCode :: Status -> Int
statusCode = Int
b } = Int
a Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
b
instance Ord Status where
compare :: Status -> Status -> Ordering
compare Status { statusCode :: Status -> Int
statusCode = Int
a } Status { statusCode :: Status -> Int
statusCode = Int
b } = Int
a Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
`compare` Int
b
instance Enum Status where
fromEnum :: Status -> Int
fromEnum = Status -> Int
statusCode
toEnum :: Int -> Status
toEnum Int
100 = Status
status100
toEnum Int
101 = Status
status101
toEnum Int
200 = Status
status200
toEnum Int
201 = Status
status201
toEnum Int
202 = Status
status202
toEnum Int
203 = Status
status203
toEnum Int
204 = Status
status204
toEnum Int
205 = Status
status205
toEnum Int
206 = Status
status206
toEnum Int
300 = Status
status300
toEnum Int
301 = Status
status301
toEnum Int
302 = Status
status302
toEnum Int
303 = Status
status303
toEnum Int
304 = Status
status304
toEnum Int
305 = Status
status305
toEnum Int
307 = Status
status307
toEnum Int
308 = Status
status308
toEnum Int
400 = Status
status400
toEnum Int
401 = Status
status401
toEnum Int
402 = Status
status402
toEnum Int
403 = Status
status403
toEnum Int
404 = Status
status404
toEnum Int
405 = Status
status405
toEnum Int
406 = Status
status406
toEnum Int
407 = Status
status407
toEnum Int
408 = Status
status408
toEnum Int
409 = Status
status409
toEnum Int
410 = Status
status410
toEnum Int
411 = Status
status411
toEnum Int
412 = Status
status412
toEnum Int
413 = Status
status413
toEnum Int
414 = Status
status414
toEnum Int
415 = Status
status415
toEnum Int
416 = Status
status416
toEnum Int
417 = Status
status417
toEnum Int
418 = Status
status418
toEnum Int
422 = Status
status422
toEnum Int
426 = Status
status426
toEnum Int
428 = Status
status428
toEnum Int
429 = Status
status429
toEnum Int
431 = Status
status431
toEnum Int
500 = Status
status500
toEnum Int
501 = Status
status501
toEnum Int
502 = Status
status502
toEnum Int
503 = Status
status503
toEnum Int
504 = Status
status504
toEnum Int
505 = Status
status505
toEnum Int
511 = Status
status511
toEnum Int
c = Int -> ByteString -> Status
mkStatus Int
c ByteString
B.empty
instance Bounded Status where
minBound :: Status
minBound = Status
status100
maxBound :: Status
maxBound = Status
status511
mkStatus :: Int -> B.ByteString -> Status
mkStatus :: Int -> ByteString -> Status
mkStatus = Int -> ByteString -> Status
Status
status100 :: Status
status100 :: Status
status100 = Int -> ByteString -> Status
mkStatus Int
100 ByteString
"Continue"
continue100 :: Status
continue100 :: Status
continue100 = Status
status100
status101 :: Status
status101 :: Status
status101 = Int -> ByteString -> Status
mkStatus Int
101 ByteString
"Switching Protocols"
switchingProtocols101 :: Status
switchingProtocols101 :: Status
switchingProtocols101 = Status
status101
status200 :: Status
status200 :: Status
status200 = Int -> ByteString -> Status
mkStatus Int
200 ByteString
"OK"
ok200 :: Status
ok200 :: Status
ok200 = Status
status200
status201 :: Status
status201 :: Status
status201 = Int -> ByteString -> Status
mkStatus Int
201 ByteString
"Created"
created201 :: Status
created201 :: Status
created201 = Status
status201
status202 :: Status
status202 :: Status
status202 = Int -> ByteString -> Status
mkStatus Int
202 ByteString
"Accepted"
accepted202 :: Status
accepted202 :: Status
accepted202 = Status
status202
status203 :: Status
status203 :: Status
status203 = Int -> ByteString -> Status
mkStatus Int
203 ByteString
"Non-Authoritative Information"
nonAuthoritative203 :: Status
nonAuthoritative203 :: Status
nonAuthoritative203 = Status
status203
status204 :: Status
status204 :: Status
status204 = Int -> ByteString -> Status
mkStatus Int
204 ByteString
"No Content"
noContent204 :: Status
noContent204 :: Status
noContent204 = Status
status204
status205 :: Status
status205 :: Status
status205 = Int -> ByteString -> Status
mkStatus Int
205 ByteString
"Reset Content"
resetContent205 :: Status
resetContent205 :: Status
resetContent205 = Status
status205
status206 :: Status
status206 :: Status
status206 = Int -> ByteString -> Status
mkStatus Int
206 ByteString
"Partial Content"
partialContent206 :: Status
partialContent206 :: Status
partialContent206 = Status
status206
status300 :: Status
status300 :: Status
status300 = Int -> ByteString -> Status
mkStatus Int
300 ByteString
"Multiple Choices"
multipleChoices300 :: Status
multipleChoices300 :: Status
multipleChoices300 = Status
status300
status301 :: Status
status301 :: Status
status301 = Int -> ByteString -> Status
mkStatus Int
301 ByteString
"Moved Permanently"
movedPermanently301 :: Status
movedPermanently301 :: Status
movedPermanently301 = Status
status301
status302 :: Status
status302 :: Status
status302 = Int -> ByteString -> Status
mkStatus Int
302 ByteString
"Found"
found302 :: Status
found302 :: Status
found302 = Status
status302
status303 :: Status
status303 :: Status
status303 = Int -> ByteString -> Status
mkStatus Int
303 ByteString
"See Other"
seeOther303 :: Status
seeOther303 :: Status
seeOther303 = Status
status303
status304 :: Status
status304 :: Status
status304 = Int -> ByteString -> Status
mkStatus Int
304 ByteString
"Not Modified"
notModified304 :: Status
notModified304 :: Status
notModified304 = Status
status304
status305 :: Status
status305 :: Status
status305 = Int -> ByteString -> Status
mkStatus Int
305 ByteString
"Use Proxy"
useProxy305 :: Status
useProxy305 :: Status
useProxy305 = Status
status305
status307 :: Status
status307 :: Status
status307 = Int -> ByteString -> Status
mkStatus Int
307 ByteString
"Temporary Redirect"
temporaryRedirect307 :: Status
temporaryRedirect307 :: Status
temporaryRedirect307 = Status
status307
status308 :: Status
status308 :: Status
status308 = Int -> ByteString -> Status
mkStatus Int
308 ByteString
"Permanent Redirect"
permanentRedirect308 :: Status
permanentRedirect308 :: Status
permanentRedirect308 = Status
status308
status400 :: Status
status400 :: Status
status400 = Int -> ByteString -> Status
mkStatus Int
400 ByteString
"Bad Request"
badRequest400 :: Status
badRequest400 :: Status
badRequest400 = Status
status400
status401 :: Status
status401 :: Status
status401 = Int -> ByteString -> Status
mkStatus Int
401 ByteString
"Unauthorized"
unauthorized401 :: Status
unauthorized401 :: Status
unauthorized401 = Status
status401
status402 :: Status
status402 :: Status
status402 = Int -> ByteString -> Status
mkStatus Int
402 ByteString
"Payment Required"
paymentRequired402 :: Status
paymentRequired402 :: Status
paymentRequired402 = Status
status402
status403 :: Status
status403 :: Status
status403 = Int -> ByteString -> Status
mkStatus Int
403 ByteString
"Forbidden"
forbidden403 :: Status
forbidden403 :: Status
forbidden403 = Status
status403
status404 :: Status
status404 :: Status
status404 = Int -> ByteString -> Status
mkStatus Int
404 ByteString
"Not Found"
notFound404 :: Status
notFound404 :: Status
notFound404 = Status
status404
status405 :: Status
status405 :: Status
status405 = Int -> ByteString -> Status
mkStatus Int
405 ByteString
"Method Not Allowed"
methodNotAllowed405 :: Status
methodNotAllowed405 :: Status
methodNotAllowed405 = Status
status405
status406 :: Status
status406 :: Status
status406 = Int -> ByteString -> Status
mkStatus Int
406 ByteString
"Not Acceptable"
notAcceptable406 :: Status
notAcceptable406 :: Status
notAcceptable406 = Status
status406
status407 :: Status
status407 :: Status
status407 = Int -> ByteString -> Status
mkStatus Int
407 ByteString
"Proxy Authentication Required"
proxyAuthenticationRequired407 :: Status
proxyAuthenticationRequired407 :: Status
proxyAuthenticationRequired407 = Status
status407
status408 :: Status
status408 :: Status
status408 = Int -> ByteString -> Status
mkStatus Int
408 ByteString
"Request Timeout"
requestTimeout408 :: Status
requestTimeout408 :: Status
requestTimeout408 = Status
status408
status409 :: Status
status409 :: Status
status409 = Int -> ByteString -> Status
mkStatus Int
409 ByteString
"Conflict"
conflict409 :: Status
conflict409 :: Status
conflict409 = Status
status409
status410 :: Status
status410 :: Status
status410 = Int -> ByteString -> Status
mkStatus Int
410 ByteString
"Gone"
gone410 :: Status
gone410 :: Status
gone410 = Status
status410
status411 :: Status
status411 :: Status
status411 = Int -> ByteString -> Status
mkStatus Int
411 ByteString
"Length Required"
lengthRequired411 :: Status
lengthRequired411 :: Status
lengthRequired411 = Status
status411
status412 :: Status
status412 :: Status
status412 = Int -> ByteString -> Status
mkStatus Int
412 ByteString
"Precondition Failed"
preconditionFailed412 :: Status
preconditionFailed412 :: Status
preconditionFailed412 = Status
status412
status413 :: Status
status413 :: Status
status413 = Int -> ByteString -> Status
mkStatus Int
413 ByteString
"Request Entity Too Large"
requestEntityTooLarge413 :: Status
requestEntityTooLarge413 :: Status
requestEntityTooLarge413 = Status
status413
status414 :: Status
status414 :: Status
status414 = Int -> ByteString -> Status
mkStatus Int
414 ByteString
"Request-URI Too Long"
requestURITooLong414 :: Status
requestURITooLong414 :: Status
requestURITooLong414 = Status
status414
status415 :: Status
status415 :: Status
status415 = Int -> ByteString -> Status
mkStatus Int
415 ByteString
"Unsupported Media Type"
unsupportedMediaType415 :: Status
unsupportedMediaType415 :: Status
unsupportedMediaType415 = Status
status415
status416 :: Status
status416 :: Status
status416 = Int -> ByteString -> Status
mkStatus Int
416 ByteString
"Requested Range Not Satisfiable"
requestedRangeNotSatisfiable416 :: Status
requestedRangeNotSatisfiable416 :: Status
requestedRangeNotSatisfiable416 = Status
status416
status417 :: Status
status417 :: Status
status417 = Int -> ByteString -> Status
mkStatus Int
417 ByteString
"Expectation Failed"
expectationFailed417 :: Status
expectationFailed417 :: Status
expectationFailed417 = Status
status417
status418 :: Status
status418 :: Status
status418 = Int -> ByteString -> Status
mkStatus Int
418 ByteString
"I'm a teapot"
imATeapot418 :: Status
imATeapot418 :: Status
imATeapot418 = Status
status418
status422 :: Status
status422 :: Status
status422 = Int -> ByteString -> Status
mkStatus Int
422 ByteString
"Unprocessable Entity"
unprocessableEntity422 :: Status
unprocessableEntity422 :: Status
unprocessableEntity422 = Status
status422
status426 :: Status
status426 :: Status
status426 = Int -> ByteString -> Status
mkStatus Int
426 ByteString
"Upgrade Required"
upgradeRequired426 :: Status
upgradeRequired426 :: Status
upgradeRequired426 = Status
status426
status428 :: Status
status428 :: Status
status428 = Int -> ByteString -> Status
mkStatus Int
428 ByteString
"Precondition Required"
preconditionRequired428 :: Status
preconditionRequired428 :: Status
preconditionRequired428 = Status
status428
status429 :: Status
status429 :: Status
status429 = Int -> ByteString -> Status
mkStatus Int
429 ByteString
"Too Many Requests"
tooManyRequests429 :: Status
tooManyRequests429 :: Status
tooManyRequests429 = Status
status429
status431 :: Status
status431 :: Status
status431 = Int -> ByteString -> Status
mkStatus Int
431 ByteString
"Request Header Fields Too Large"
requestHeaderFieldsTooLarge431 :: Status
= Status
status431
status500 :: Status
status500 :: Status
status500 = Int -> ByteString -> Status
mkStatus Int
500 ByteString
"Internal Server Error"
internalServerError500 :: Status
internalServerError500 :: Status
internalServerError500 = Status
status500
status501 :: Status
status501 :: Status
status501 = Int -> ByteString -> Status
mkStatus Int
501 ByteString
"Not Implemented"
notImplemented501 :: Status
notImplemented501 :: Status
notImplemented501 = Status
status501
status502 :: Status
status502 :: Status
status502 = Int -> ByteString -> Status
mkStatus Int
502 ByteString
"Bad Gateway"
badGateway502 :: Status
badGateway502 :: Status
badGateway502 = Status
status502
status503 :: Status
status503 :: Status
status503 = Int -> ByteString -> Status
mkStatus Int
503 ByteString
"Service Unavailable"
serviceUnavailable503 :: Status
serviceUnavailable503 :: Status
serviceUnavailable503 = Status
status503
status504 :: Status
status504 :: Status
status504 = Int -> ByteString -> Status
mkStatus Int
504 ByteString
"Gateway Timeout"
gatewayTimeout504 :: Status
gatewayTimeout504 :: Status
gatewayTimeout504 = Status
status504
status505 :: Status
status505 :: Status
status505 = Int -> ByteString -> Status
mkStatus Int
505 ByteString
"HTTP Version Not Supported"
httpVersionNotSupported505 :: Status
httpVersionNotSupported505 :: Status
httpVersionNotSupported505 = Status
status505
status511 :: Status
status511 :: Status
status511 = Int -> ByteString -> Status
mkStatus Int
511 ByteString
"Network Authentication Required"
networkAuthenticationRequired511 :: Status
networkAuthenticationRequired511 :: Status
networkAuthenticationRequired511 = Status
status511
statusIsInformational :: Status -> Bool
statusIsInformational :: Status -> Bool
statusIsInformational (Status {statusCode :: Status -> Int
statusCode=Int
code}) = Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
100 Bool -> Bool -> Bool
&& Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
200
statusIsSuccessful :: Status -> Bool
statusIsSuccessful :: Status -> Bool
statusIsSuccessful (Status {statusCode :: Status -> Int
statusCode=Int
code}) = Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
200 Bool -> Bool -> Bool
&& Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
300
statusIsRedirection :: Status -> Bool
statusIsRedirection :: Status -> Bool
statusIsRedirection (Status {statusCode :: Status -> Int
statusCode=Int
code}) = Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
300 Bool -> Bool -> Bool
&& Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
400
statusIsClientError :: Status -> Bool
statusIsClientError :: Status -> Bool
statusIsClientError (Status {statusCode :: Status -> Int
statusCode=Int
code}) = Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
400 Bool -> Bool -> Bool
&& Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
500
statusIsServerError :: Status -> Bool
statusIsServerError :: Status -> Bool
statusIsServerError (Status {statusCode :: Status -> Int
statusCode=Int
code}) = Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
500 Bool -> Bool -> Bool
&& Int
code Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
600