1.0.0 • Published 5 years ago

@zcorky/statuses v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

statuses

NPM version Coverage Status Dependencies Build Status license issues

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