blow-http-statuses
v0.2.4
Published
Helper for HTTP Statuses
Downloads
10
Maintainers
Readme
blow-http-statuses
Access to codes via literals.
import {Codes} from 'blow-http-statuses';
console.log(Codes.OK); // 200
console.log(Codes.BadGateway); // 502
Access to messages via codes.
import {Messages} from 'blow-http-statuses';
console.log(Messages[200]); // OK
console.log(Messages[502]); // Bad Gateway
Get status as JSON object
import {status} from 'blow-http-statuses';
console.log(status('OK')); // { code: 200, message: 'OK' }
console.log(status(502); // { code: 502, message: 'Bad Gateway' }
Helper methods which allow to check type of status.
import {isEmpty, isRedirect, isRetry} from 'blow-http-statuses';
console.log(isEmpty(Codes.NoContent)); // true
console.log(isRedirect(Codes.MultipleChoices)); // true
console.log(isRetry(Codes.BadGateway)); // true