jshttp/statuses
Tentang
Utilitas untuk status HTTP
Proyek lainnyaPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- +1
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Aslistatuses
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
Jelajahi proyek terkait
Memuat…