STATUS_CODE
import { STATUS_CODE } from "jsr:@ende/http";variable
const STATUS_CODE: { … }Contains the STATUS_CODE object which contains standard HTTP
status codes and provides several type guards for handling status codes
with type safety.
Example: The status code and status text
import {
STATUS_CODE,
STATUS_TEXT,
} from "@ende/http/status";
console.log(STATUS_CODE.NotFound); // Returns 404
console.log(STATUS_TEXT[STATUS_CODE.NotFound]); // Returns "Not Found"
Example: Checking the status code type
import { isErrorStatus } from "@ende/http/status";
const res = await fetch("https://example.com/");
if (isErrorStatus(res.status)) {
// error handling here...
}
await res.body?.cancel();
Properties
Continue
Continue: numberRFC 7231, 6.2.1
SwitchingProtocols
SwitchingProtocols: numberRFC 7231, 6.2.2
Processing
Processing: numberRFC 2518, 10.1
EarlyHints
EarlyHints: numberRFC 8297 *
OK
OK: numberRFC 7231, 6.3.1
Created
Created: numberRFC 7231, 6.3.2
Accepted
Accepted: numberRFC 7231, 6.3.3
NonAuthoritativeInfo
NonAuthoritativeInfo: numberRFC 7231, 6.3.4
NoContent
NoContent: numberRFC 7231, 6.3.5
ResetContent
ResetContent: numberRFC 7231, 6.3.6
PartialContent
PartialContent: numberRFC 7233, 4.1
MultiStatus
MultiStatus: numberRFC 4918, 11.1
AlreadyReported
AlreadyReported: numberRFC 5842, 7.1
IMUsed
IMUsed: numberRFC 3229, 10.4.1
MultipleChoices
MultipleChoices: numberRFC 7231, 6.4.1
MovedPermanently
MovedPermanently: numberRFC 7231, 6.4.2
Found
Found: numberRFC 7231, 6.4.3
SeeOther
SeeOther: numberRFC 7231, 6.4.4
NotModified
NotModified: numberRFC 7232, 4.1
UseProxy
UseProxy: numberRFC 7231, 6.4.5
TemporaryRedirect
TemporaryRedirect: numberRFC 7231, 6.4.7
PermanentRedirect
PermanentRedirect: numberRFC 7538, 3
BadRequest
BadRequest: numberRFC 7231, 6.5.1
Unauthorized
Unauthorized: numberRFC 7235, 3.1
PaymentRequired
PaymentRequired: numberRFC 7231, 6.5.2
Forbidden
Forbidden: numberRFC 7231, 6.5.3
NotFound
NotFound: numberRFC 7231, 6.5.4
MethodNotAllowed
MethodNotAllowed: numberRFC 7231, 6.5.5
NotAcceptable
NotAcceptable: numberRFC 7231, 6.5.6
ProxyAuthRequired
ProxyAuthRequired: numberRFC 7235, 3.2
RequestTimeout
RequestTimeout: numberRFC 7231, 6.5.7
Conflict
Conflict: numberRFC 7231, 6.5.8
Gone
Gone: numberRFC 7231, 6.5.9
LengthRequired
LengthRequired: numberRFC 7231, 6.5.10
PreconditionFailed
PreconditionFailed: numberRFC 7232, 4.2
ContentTooLarge
ContentTooLarge: numberRFC 7231, 6.5.11
URITooLong
URITooLong: numberRFC 7231, 6.5.12
UnsupportedMediaType
UnsupportedMediaType: numberRFC 7231, 6.5.13
RangeNotSatisfiable
RangeNotSatisfiable: numberRFC 7233, 4.4
ExpectationFailed
ExpectationFailed: numberRFC 7231, 6.5.14
Teapot
Teapot: numberRFC 7168, 2.3.3
MisdirectedRequest
MisdirectedRequest: numberRFC 7540, 9.1.2
UnprocessableEntity
UnprocessableEntity: numberRFC 4918, 11.2
Locked
Locked: numberRFC 4918, 11.3
FailedDependency
FailedDependency: numberRFC 4918, 11.4
TooEarly
TooEarly: numberRFC 8470, 5.2
UpgradeRequired
UpgradeRequired: numberRFC 7231, 6.5.15
PreconditionRequired
PreconditionRequired: numberRFC 6585, 3
TooManyRequests
TooManyRequests: numberRFC 6585, 4
RequestHeaderFieldsTooLarge
RequestHeaderFieldsTooLarge: numberRFC 6585, 5
UnavailableForLegalReasons
UnavailableForLegalReasons: numberRFC 7725, 3
InternalServerError
InternalServerError: numberRFC 7231, 6.6.1
NotImplemented
NotImplemented: numberRFC 7231, 6.6.2
BadGateway
BadGateway: numberRFC 7231, 6.6.3
ServiceUnavailable
ServiceUnavailable: numberRFC 7231, 6.6.4
GatewayTimeout
GatewayTimeout: numberRFC 7231, 6.6.5
HTTPVersionNotSupported
HTTPVersionNotSupported: numberRFC 7231, 6.6.6
VariantAlsoNegotiates
VariantAlsoNegotiates: numberRFC 2295, 8.1
InsufficientStorage
InsufficientStorage: numberRFC 4918, 11.5
LoopDetected
LoopDetected: numberRFC 5842, 7.2
NotExtended
NotExtended: numberRFC 2774, 7
NetworkAuthenticationRequired
NetworkAuthenticationRequired: numberRFC 6585, 6