Module Fetch_Core.Status

type informational = [
| `Continue
| `SwitchingProtocols
| `Processing
]
type success = [
| `OK
| `Created
| `Accepted
| `NonAuthoritativeInformation
| `NoContent
| `ResetContent
| `PartialContent
| `MultiStatus
| `AlreadyReported
| `IMUsed
]
type redirection = [
| `MultipleChoices
| `MovedPermanently
| `Found
| `SeeOther
| `NotModified
| `UseProxy
| `TemporaryRedirect
| `PermanentRedirect
]
type clientError = [
| `BadRequest
| `Unauthorized
| `PaymentRequired
| `Forbidden
| `NotFound
| `MethodNotAllowed
| `NotAcceptable
| `ProxyAuthenticationRequired
| `RequestTimeout
| `Conflict
| `Gone
| `LengthRequired
| `PreconditionFailed
| `PayloadTooLarge
| `UriTooLong
| `UnsupportedMediaType
| `RangeNotSatisfiable
| `ExpectationFailed
| `ImATeapot
| `MisdirectedRequest
| `UnprocessableEntity
| `Locked
| `FailedDependency
| `UpgradeRequired
| `PreconditionRequired
| `TooManyRequests
| `RequestHeaderFieldsTooLarge
| `UnavailableForLegalReasons
]
type serverError = [
| `InternalServerError
| `NotImplemented
| `BadGateway
| `ServiceUnavailable
| `GatewayTimeout
| `HttpVersionNotSupported
| `VariantAlsoNegotiates
| `InsufficientStorage
| `LoopDetected
| `NotExtended
| `NetworkAuthenticationRequired
]
type standard = [
| clientError
| informational
| redirection
| serverError
| success
]
type t = [
| standard
| `Other of int
]
val toCode : t -> int

Returns a code as an int from a t.

Examples

Status.toCode(`OK) = 200
Status.toCode(`Other(999)) = 999
val ofCode : int -> t

Returns a t from an int.

Examples

Status.ofCode(200) = `OK
Status.ofCode(999) = `Other(999)
val isInformational : t -> bool

Returns true if the status is informational.

Examples

Status.isInformational(`Continue) = true
Status.isInformational(`NotFound) = false
Status.isInformational(`OK) = false
val isSuccessful : t -> bool

Returns true if the status is successful.

Examples

Status.isSuccessful(`OK) = true
Status.isSuccessful(`InternalServerError) = false
val isRedirect : t -> bool

Returns true if the status is a redirect.

Examples

Status.isRedirect(`MovedPermanently) = true
Status.isRedirect(`InternalServerError) = false
val isClientError : t -> bool

Returns true if the status is that of a client error.

Examples

Status.isClientError(`NotFound) = true
Status.isClientError(`InternalServerError) = false
Status.isClientError(`OK) = false
val isServerError : t -> bool

Returns true if the status is that of a server error.

Examples

Status.isServerError(`InternalServerError) = true
Status.isServerError(`NotFound) = false
Status.isServerError(`OK) = false
val isError : t -> bool

Returns true if the status is an error, either of type client or server.

Examples

Status.isError(`InternalServerError) = true
Status.isError(`NotFound) = true
Status.isError(`OK) = false
val make : int -> t