http-types-0.12.4: Generic HTTP types for Haskell (for both client and server code).

Safe Haskell | Safe-Inferred
Language | Haskell2010

Network.HTTP.Types.Status

Contents

- HTTP Status
- Common statuses
- Checking status code category

Description

Types and constants to describe HTTP status codes.

At the bottom are some functions to check if a given `Status` is from a certain category. (i.e. `1XX`, `2XX`, etc.)

Synopsis

- data Status = Status Int ByteString
- statusCode :: Status -> Int
- statusMessage :: Status -> ByteString
- mkStatus :: Int -> ByteString -> Status
- status100 :: Status
- continue100 :: Status
- status101 :: Status
- switchingProtocols101 :: Status
- status200 :: Status
- ok200 :: Status
- status201 :: Status
- created201 :: Status
- status202 :: Status
- accepted202 :: Status
- status203 :: Status
- nonAuthoritative203 :: Status
- status204 :: Status
- noContent204 :: Status
- status205 :: Status
- resetContent205 :: Status
- status206 :: Status
- partialContent206 :: Status
- status300 :: Status
- multipleChoices300 :: Status
- status301 :: Status
- movedPermanently301 :: Status
- status302 :: Status
- found302 :: Status
- status303 :: Status
- seeOther303 :: Status
- status304 :: Status
- notModified304 :: Status
- status305 :: Status
- useProxy305 :: Status
- status307 :: Status
- temporaryRedirect307 :: Status
- status308 :: Status
- permanentRedirect308 :: Status
- status400 :: Status
- badRequest400 :: Status
- status401 :: Status
- unauthorized401 :: Status
- status402 :: Status
- paymentRequired402 :: Status
- status403 :: Status
- forbidden403 :: Status
- status404 :: Status
- notFound404 :: Status
- status405 :: Status
- methodNotAllowed405 :: Status
- status406 :: Status
- notAcceptable406 :: Status
- status407 :: Status
- proxyAuthenticationRequired407 :: Status
- status408 :: Status
- requestTimeout408 :: Status
- status409 :: Status
- conflict409 :: Status
- status410 :: Status
- gone410 :: Status
- status411 :: Status
- lengthRequired411 :: Status
- status412 :: Status
- preconditionFailed412 :: Status
- status413 :: Status
- requestEntityTooLarge413 :: Status
- status414 :: Status
- requestURITooLong414 :: Status
- status415 :: Status
- unsupportedMediaType415 :: Status
- status416 :: Status
- requestedRangeNotSatisfiable416 :: Status
- status417 :: Status
- expectationFailed417 :: Status
- status418 :: Status
- imATeapot418 :: Status
- status422 :: Status
- unprocessableEntity422 :: Status
- status426 :: Status
- upgradeRequired426 :: Status
- status428 :: Status
- preconditionRequired428 :: Status
- status429 :: Status
- tooManyRequests429 :: Status
- status431 :: Status
- requestHeaderFieldsTooLarge431 :: Status
- status500 :: Status
- internalServerError500 :: Status
- status501 :: Status
- notImplemented501 :: Status
- status502 :: Status
- badGateway502 :: Status
- status503 :: Status
- serviceUnavailable503 :: Status
- status504 :: Status
- gatewayTimeout504 :: Status
- status505 :: Status
- status511 :: Status
- networkAuthenticationRequired511 :: Status
- httpVersionNotSupported505 :: Status
- statusIsInformational :: Status -> Bool
- statusIsSuccessful :: Status -> Bool
- statusIsRedirection :: Status -> Bool
- statusIsClientError :: Status -> Bool
- statusIsServerError :: Status -> Bool

# HTTP Status

data Status #

HTTP Status.

Only the `statusCode` is used for comparisons.

Please use `mkStatus` to create status codes from code and message, or the `Enum` instance or the status code constants (like `ok200`). There might be additional record members in the future.

Note that the `Show` instance is only for debugging.

Constructors

Status Int ByteString |

#### Instances

Instances details

Data Status # | Since: 0.12.4
Instance details Defined in Network.HTTP.Types.Status Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Status -> c Status # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Status # toConstr :: Status -> Constr # dataTypeOf :: Status -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Status) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Status) # gmapT :: (forall b. Data b => b -> b) -> Status -> Status # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Status -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Status -> r # gmapQ :: (forall d. Data d => d -> u) -> Status -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Status -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Status -> m Status # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Status -> m Status # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Status -> m Status #
Bounded Status # | Since: 0.11
Instance details Defined in Network.HTTP.Types.Status Methods minBound :: Status # maxBound :: Status #
Enum Status # | Be advised, that when using the "enumFrom*" family of methods or ranges in lists, it will generate all possible status codes. E.g. `[status100 .. status200]` generates `Status`es of `100, 101, 102 .. 198, 199, 200` The statuses not included in this library will have an empty message. Since: 0.7.3
Instance details Defined in Network.HTTP.Types.Status Methods succ :: Status -> Status # pred :: Status -> Status # toEnum :: Int -> Status # fromEnum :: Status -> Int # enumFrom :: Status -> [Status] # enumFromThen :: Status -> Status -> [Status] # enumFromTo :: Status -> Status -> [Status] # enumFromThenTo :: Status -> Status -> Status -> [Status] #
Generic Status # |
Instance details Defined in Network.HTTP.Types.Status Associated Types
type Rep Status | Since: http-types-0.12.4
Instance details Defined in Network.HTTP.Types.Status type Rep Status = D1 ('MetaData "Status" "Network.HTTP.Types.Status" "http-types-0.12.4-HhEPaOzd8crnbrvqiOppv" 'False) (C1 ('MetaCons "Status" 'PrefixI 'True) (S1 ('MetaSel ('Just "statusCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "statusMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))
Methods from :: Status -> Rep Status x # to :: Rep Status x -> Status #
Show Status # |
Instance details Defined in Network.HTTP.Types.Status Methods showsPrec :: Int -> Status -> ShowS # show :: Status -> String # showList :: [Status] -> ShowS #
Eq Status # | A `Status` is equal to another `Status` if the status codes are equal.
Instance details Defined in Network.HTTP.Types.Status Methods (==) :: Status -> Status -> Bool # (/=) :: Status -> Status -> Bool #
Ord Status # | `Status`es are ordered according to their status codes only.
Instance details Defined in Network.HTTP.Types.Status Methods compare :: Status -> Status -> Ordering # (<) :: Status -> Status -> Bool # (<=) :: Status -> Status -> Bool # (>) :: Status -> Status -> Bool # (>=) :: Status -> Status -> Bool # max :: Status -> Status -> Status # min :: Status -> Status -> Status #
type Rep Status # | Since: 0.12.4
Instance details Defined in Network.HTTP.Types.Status type Rep Status = D1 ('MetaData "Status" "Network.HTTP.Types.Status" "http-types-0.12.4-HhEPaOzd8crnbrvqiOppv" 'False) (C1 ('MetaCons "Status" 'PrefixI 'True) (S1 ('MetaSel ('Just "statusCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "statusMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))

statusCode :: Status -> Int #

statusMessage :: Status -> ByteString #

mkStatus :: Int -> ByteString -> Status #

Create a `Status` from a status code and message.

# Common statuses

status100 :: Status #

Continue 100

Since: 0.6.6

continue100 :: Status #

Continue 100

Since: 0.6.6

status101 :: Status #

Switching Protocols 101

Since: 0.6.6

switchingProtocols101 :: Status #

Switching Protocols 101

Since: 0.6.6

status200 :: Status #

OK 200

ok200 :: Status #

OK 200

status201 :: Status #

Created 201

created201 :: Status #

Created 201

status202 :: Status #

Accepted 202

Since: 0.6.6

accepted202 :: Status #

Accepted 202

Since: 0.6.6

status203 :: Status #

Non-Authoritative Information 203

Since: 0.6.6

nonAuthoritative203 :: Status #

Non-Authoritative Information 203

Since: 0.6.6

status204 :: Status #

No Content 204

Since: 0.6.6

noContent204 :: Status #

No Content 204

Since: 0.6.6

status205 :: Status #

Reset Content 205

Since: 0.6.6

resetContent205 :: Status #

Reset Content 205

Since: 0.6.6

status206 :: Status #

Partial Content 206

Since: 0.5.1

partialContent206 :: Status #

Partial Content 206

Since: 0.5.1

status300 :: Status #

Multiple Choices 300

multipleChoices300 :: Status #

Multiple Choices 300

status301 :: Status #

Moved Permanently 301

movedPermanently301 :: Status #

Moved Permanently 301

status302 :: Status #

Found 302

found302 :: Status #

Found 302

status303 :: Status #

See Other 303

seeOther303 :: Status #

See Other 303

status304 :: Status #

Not Modified 304

Since: 0.6.1

notModified304 :: Status #

Not Modified 304

Since: 0.6.1

status305 :: Status #

Use Proxy 305

Since: 0.6.6

useProxy305 :: Status #

Use Proxy 305

Since: 0.6.6

status307 :: Status #

Temporary Redirect 307

Since: 0.6.6

temporaryRedirect307 :: Status #

Temporary Redirect 307

Since: 0.6.6

status308 :: Status #

Permanent Redirect 308

Since: 0.9

permanentRedirect308 :: Status #

Permanent Redirect 308

Since: 0.9

status400 :: Status #

Bad Request 400

badRequest400 :: Status #

Bad Request 400

status401 :: Status #

Unauthorized 401

unauthorized401 :: Status #

Unauthorized 401

status402 :: Status #

Payment Required 402

Since: 0.6.6

paymentRequired402 :: Status #

Payment Required 402

Since: 0.6.6

status403 :: Status #

Forbidden 403

forbidden403 :: Status #

Forbidden 403

status404 :: Status #

Not Found 404

notFound404 :: Status #

Not Found 404

status405 :: Status #

Method Not Allowed 405

methodNotAllowed405 :: Status #

Method Not Allowed 405

status406 :: Status #

Not Acceptable 406

Since: 0.6.6

notAcceptable406 :: Status #

Not Acceptable 406

Since: 0.6.6

status407 :: Status #

Proxy Authentication Required 407

Since: 0.6.6

proxyAuthenticationRequired407 :: Status #

Proxy Authentication Required 407

Since: 0.6.6

status408 :: Status #

Request Timeout 408

Since: 0.6.6

requestTimeout408 :: Status #

Request Timeout 408

Since: 0.6.6

status409 :: Status #

Conflict 409

Since: 0.6.6

conflict409 :: Status #

Conflict 409

Since: 0.6.6

status410 :: Status #

Gone 410

Since: 0.6.6

gone410 :: Status #

Gone 410

Since: 0.6.6

status411 :: Status #

Length Required 411

Since: 0.6.6

lengthRequired411 :: Status #

Length Required 411

Since: 0.6.6

status412 :: Status #

Precondition Failed 412

Since: 0.6.1

preconditionFailed412 :: Status #

Precondition Failed 412

Since: 0.6.1

status413 :: Status #

Request Entity Too Large 413

Since: 0.6.6

requestEntityTooLarge413 :: Status #

Request Entity Too Large 413

Since: 0.6.6

status414 :: Status #

Request-URI Too Long 414

Since: 0.6.6

requestURITooLong414 :: Status #

Request-URI Too Long 414

Since: 0.6.6

status415 :: Status #

Unsupported Media Type 415

Since: 0.6.6

unsupportedMediaType415 :: Status #

Unsupported Media Type 415

Since: 0.6.6

status416 :: Status #

Requested Range Not Satisfiable 416

Since: 0.6.1

requestedRangeNotSatisfiable416 :: Status #

Requested Range Not Satisfiable 416

Since: 0.6.1

status417 :: Status #

Expectation Failed 417

Since: 0.6.6

expectationFailed417 :: Status #

Expectation Failed 417

Since: 0.6.6

status418 :: Status #

I'm a teapot 418

Since: 0.6.6

imATeapot418 :: Status #

I'm a teapot 418

Since: 0.6.6

status422 :: Status #

Unprocessable Entity 422 (RFC 4918)

Since: 0.9.1

unprocessableEntity422 :: Status #

Unprocessable Entity 422 (RFC 4918)

Since: 0.9.1

status426 :: Status #

Upgrade Required 426 (https://tools.ietf.org/html/rfc7231#section-6.5.15)

Since: 0.10

upgradeRequired426 :: Status #

Upgrade Required 426 (https://tools.ietf.org/html/rfc7231#section-6.5.15)

Since: 0.10

status428 :: Status #

Precondition Required 428 (RFC 6585)

Since: 0.8.5

preconditionRequired428 :: Status #

Precondition Required 428 (RFC 6585)

Since: 0.8.5

status429 :: Status #

Too Many Requests 429 (RFC 6585)

Since: 0.8.5

tooManyRequests429 :: Status #

Too Many Requests 429 (RFC 6585)

Since: 0.8.5

status431 :: Status #

Request Header Fields Too Large 431 (RFC 6585)

Since: 0.8.5

requestHeaderFieldsTooLarge431 :: Status #

Request Header Fields Too Large 431 (RFC 6585)

Since: 0.8.5

status500 :: Status #

Internal Server Error 500

internalServerError500 :: Status #

Internal Server Error 500

status501 :: Status #

Not Implemented 501

Since: 0.6.1

notImplemented501 :: Status #

Not Implemented 501

Since: 0.6.1

status502 :: Status #

Bad Gateway 502

Since: 0.6.6

badGateway502 :: Status #

Bad Gateway 502

Since: 0.6.6

status503 :: Status #

Service Unavailable 503

Since: 0.6.6

serviceUnavailable503 :: Status #

Service Unavailable 503

Since: 0.6.6

status504 :: Status #

Gateway Timeout 504

Since: 0.6.6

gatewayTimeout504 :: Status #

Gateway Timeout 504

Since: 0.6.6

status505 :: Status #

HTTP Version Not Supported 505

Since: 0.6.6

status511 :: Status #

Network Authentication Required 511 (RFC 6585)

Since: 0.8.5

networkAuthenticationRequired511 :: Status #

Network Authentication Required 511 (RFC 6585)

Since: 0.8.5

httpVersionNotSupported505 :: Status #

HTTP Version Not Supported 505

Since: 0.6.6

# Checking status code category

statusIsInformational :: Status -> Bool #

Informational class

Checks if the status is in the 1XX range.

Since: 0.8.0

statusIsSuccessful :: Status -> Bool #

Successful class

Checks if the status is in the 2XX range.

Since: 0.8.0

statusIsRedirection :: Status -> Bool #

Redirection class

Checks if the status is in the 3XX range.

Since: 0.8.0

statusIsClientError :: Status -> Bool #

Client Error class

Checks if the status is in the 4XX range.

Since: 0.8.0

statusIsServerError :: Status -> Bool #

Server Error class

Checks if the status is in the 5XX range.

Since: 0.8.0