Skip to content
المشاريع

حول

أداة مساعدة لحالات HTTP

مشاريع أخرى

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
+١
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

statuses

NPM Version NPM Downloads Node.js Version Build Status Test Coverage

HTTP status utility.

This module provides a list of status codes and messages sourced from a few different projects:

Installation

$ npm install statuses

API

import { codes, isEmpty, isRedirect, isRetry, message } from "statuses";

message[code]

The status message for a known numeric HTTP status code, or undefined for an unknown code.

message[306]; // => undefined
message[404]; // => "Not Found"

codes

An array containing the built-in numeric HTTP status codes. Prefer message[code] !== undefined to check whether a code is in the message table.

codes.includes(306); // => false
codes.includes(404); // => true

isEmpty(code)

Returns true for final response status codes that forbid a body (204, 205, and 304), and false otherwise.

isEmpty(200); // => false
isEmpty(204); // => true
isEmpty(304); // => true

isRedirect(code)

Returns true for redirect status codes and false otherwise.

isRedirect(200); // => false
isRedirect(301); // => true

isRetry(code)

Returns true for gateway or service failures that may warrant a retry (502, 503, and 504), and false otherwise.

isRetry(501); // => false
isRetry(503); // => true

Development

We add new status codes and update existing reason phrases in the current major version. Removing a status code requires a new major version.

License

MIT

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…