New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

httpstatus-by-name

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

httpstatus-by-name

Get HTTP-Status number by name

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

httpstatus-by-Name

Get HTTP-Status number by name

Why

In Rest-API's it is very important to use the right HTTP-Status codes. Often times we set or check against these codes. I prefere a source like if res.statusCode == status.No_Content instead of res.statusCode == 204 a lot more!

Install

npm install httpstatus-by-name 

Usage

var status = require('httpstatus-by-name');

…your routes…
res.send(status.Forbidden); // it is forbidden to use this resurce

Internals

This module is just a map from names to Numbers. It does not have any functions. If you need to list all the codes, you should do the trick with underscore

_.each(_.keys(status), function(name){
	console.log(name, "=", status[name]);
})

Keywords

http

FAQs

Package last updated on 09 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts