1.0.0 • Published 5 years ago
@zcorky/statuses v1.0.0
statuses
HTTP status utility with typescript
This module provides a list of status codes and messages sourced from a few different projects:
Install
$ npm install @zcorky/statuses
Usage
// see more in test
// typescript
import status, { isRedirect, isEmpty, isRetry } from '@zcorky/statuses';
// status
status(403) // => 403
status('403') // => 403
status('Forbidden') // => 403
status(306) // throws, as it's not supported by node.js
// status codes for redirects
// 300, 301, 302, 303, 305, 307, 308
isRedirect(300); // => true
// status codes for empty bodies
// 204, 205, 304
isEmpty(204); // => true
// status codes for when you should retry the request
// 502, 503, 504
isRetry(502); // => true
Relatived
- statuses - HTTP status utility for node.
License
MIT © Moeover
1.0.0
5 years ago