Deprecated
(will be removed after 0.210.0) Import from std/http/status.ts
instead.
Contains the enum Status
which enumerates standard HTTP status
codes and provides several type guards for handling status codes with type
safety.
import * as netzo from "https://deno.land/x/netzo@0.3.66/deps/std/http/http_status.ts";
Examples
Example 1
Example 1
import {
Status,
STATUS_TEXT,
} from "https://deno.land/std@0.224.0/http/http_status.ts";
console.log(Status.NotFound); //=> 404
console.log(STATUS_TEXT[Status.NotFound]); //=> "Not Found"
import { isErrorStatus } from "https://deno.land/std@0.224.0/http/http_status.ts";
const res = await fetch("https://example.com/");
if (isErrorStatus(res.status)) {
// error handling here...
}