Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/src/src.deps.ts>STATUS_CODE

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
variable STATUS_CODE
Re-export
import { STATUS_CODE } from "https://deno.land/x/fathym_common@v0.0.155/src/src.deps.ts";

Contains the STATUS_CODE object which contains standard HTTP status codes and provides several type guards for handling status codes with type safety.

Examples

Example 1

import {
  STATUS_CODE,
  STATUS_TEXT,
} from "https://deno.land/std@0.224.0/http/status.ts";

console.log(STATUS_CODE.NotFound); // Returns 404
console.log(STATUS_TEXT[STATUS_CODE.NotFound]); // Returns "Not Found"

Example 2

import { isErrorStatus } from "https://deno.land/std@0.224.0/http/status.ts";

const res = await fetch("https://example.com/");

if (isErrorStatus(res.status)) {
  // error handling here...
}

type

{ Continue: number; SwitchingProtocols: number; Processing: number; EarlyHints: number; OK: number; Created: number; Accepted: number; NonAuthoritativeInfo: number; NoContent: number; ResetContent: number; PartialContent: number; MultiStatus: number; AlreadyReported: number; IMUsed: number; MultipleChoices: number; MovedPermanently: number; Found: number; SeeOther: number; NotModified: number; UseProxy: number; TemporaryRedirect: number; PermanentRedirect: number; BadRequest: number; Unauthorized: number; PaymentRequired: number; Forbidden: number; NotFound: number; MethodNotAllowed: number; NotAcceptable: number; ProxyAuthRequired: number; RequestTimeout: number; Conflict: number; Gone: number; LengthRequired: number; PreconditionFailed: number; ContentTooLarge: number; URITooLong: number; UnsupportedMediaType: number; RangeNotSatisfiable: number; ExpectationFailed: number; Teapot: number; MisdirectedRequest: number; UnprocessableEntity: number; Locked: number; FailedDependency: number; TooEarly: number; UpgradeRequired: number; PreconditionRequired: number; TooManyRequests: number; RequestHeaderFieldsTooLarge: number; UnavailableForLegalReasons: number; InternalServerError: number; NotImplemented: number; BadGateway: number; ServiceUnavailable: number; GatewayTimeout: number; HTTPVersionNotSupported: number; VariantAlsoNegotiates: number; InsufficientStorage: number; LoopDetected: number; NotExtended: number; NetworkAuthenticationRequired: number; }