Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-status

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-status

status code response helper

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
109
decreased by-44.1%
Maintainers
1
Weekly downloads
 
Created
Source

express-status

Extends express response prototype with status codes helper methods.

Build Status

Purpose

The purpose of this library is to remove magic numbers from your code and define the status codes in one place.

Install

npm install express-status

Test

test with code coverage

gulp

unit test only

gulp test

Document

Documentation is managed by commenting code with jsdoc and editing the template. You can regenerate the README.md by executing

gulp doc
<a name="module_express-status"></a>

express-status

Exports an object with status codes and extends the express request object by adding a method that will set the status code and return the request object.

Example

var statusCodes = require()

express-status.badRequest()

sets res status code to 400

Kind: static method of express-status
Example

function(req, res){
 res.badRequest().end();
}

express-status.unauthorized()

sets res status code to 401

Kind: static method of express-status
Example

function(req, res){
 res.unauthorized().end();
}

express-status.forbidden()

sets res status code to 403

Kind: static method of express-status
Example

function(req, res){
 res.forbidden().end();
}

express-status.notFound()

sets res status code to 404

Kind: static method of express-status
Example

function(req, res){
 res.notFound().end();
}

express-status.methodNotAllowed()

sets res status code to 405

Kind: static method of express-status
Example

function(req, res){
 res.methodNotAllowed().end();
}

express-status.notAcceptable()

sets res status code to 406

Kind: static method of express-status
Example

function(req, res){
 res.notAcceptable().end();
}

express-status.proxyAuthenticationRequired()

sets res status code to 407

Kind: static method of express-status
Example

function(req, res){
 res.proxyAuthenticationRequired().end();
}

express-status.requestTimeout()

sets res status code to 408

Kind: static method of express-status
Example

function(req, res){
 res.requestTimeout().end();
}

express-status.conflict()

sets res status code to 409

Kind: static method of express-status
Example

function(req, res){
 res.conflict().end();
}

express-status.gone()

sets res status code to 410

Kind: static method of express-status
Example

function(req, res){
 res.gone().end();
}

express-status.lengthRequired()

sets res status code to 411

Kind: static method of express-status
Example

function(req, res){
 res.lengthRequired().end();
}

express-status.preconditionFailed()

sets res status code to 412

Kind: static method of express-status
Example

function(req, res){
 res.preconditionFailed().end();
}

express-status.requestEntityTooLarge()

sets res status code to 413

Kind: static method of express-status
Example

function(req, res){
 res.requestEntityTooLarge().end();
}

express-status.requestUriTooLang()

sets res status code to 414

Kind: static method of express-status
Example

function(req, res){
 res.requestUriTooLang().end();
}

express-status.unsupportedMediaType()

sets res status code to 415

Kind: static method of express-status
Example

function(req, res){
 res.unsupportedMediaType().end();
}

express-status.requestedRangeNotSatisfiable()

sets res status code to 416

Kind: static method of express-status
Example

function(req, res){
 res.requestedRangeNotSatisfiable().end();
}

express-status.expectationFailed()

sets res status code to 417

Kind: static method of express-status
Example

function(req, res){
 res.expectationFailed().end();
}

express-status.imATeapot()

sets res status code to 418

Kind: static method of express-status
Example

function(req, res){
 res.imATeapot().end();
}

express-status.authenticationTimeout()

sets res status code to 419

Kind: static method of express-status
Example

function(req, res){
 res.authenticationTimeout().end();
}

express-status.locked()

sets res status code to 423

Kind: static method of express-status
Example

function(req, res){
 res.locked().end();
}

express-status.failedDependency()

sets res status code to 424

Kind: static method of express-status
Example

function(req, res){
 res.failedDependency().end();
}

express-status.upgradeRequired()

sets res status code to 426

Kind: static method of express-status
Example

function(req, res){
 res.upgradeRequired().end();
}

express-status.preconditionRequired()

sets res status code to 428

Kind: static method of express-status
Example

function(req, res){
 res.preconditionRequired().end();
}

express-status.tooManyRequests()

sets res status code to 429

Kind: static method of express-status
Example

function(req, res){
 res.tooManyRequests().end();
}

express-status.requestHeaderFieldTooLarge()

sets res status code to 431

Kind: static method of express-status
Example

function(req, res){
 res.requestHeaderFieldTooLarge().end();
}

express-status.loginTimeout()

sets res status code to 440

Kind: static method of express-status
Example

function(req, res){
 res.loginTimeout().end();
}

express-status.unavailableForLegalReasons()

sets res status code to 451

Kind: static method of express-status
Example

function(req, res){
 res.unavailableForLegalReasons().end();
}

express-status.internalServerError()

sets res status code to 500

Kind: static method of express-status
Example

function(req, res){
 res.internalServerError().end();
}

express-status.notImplemented()

sets res status code to 501

Kind: static method of express-status
Example

function(req, res){
 res.notImplemented().end();
}

express-status.badGateway()

sets res status code to 502

Kind: static method of express-status
Example

function(req, res){
 res.badGateway().end();
}

express-status.serviceUnavailable()

sets res status code to 503

Kind: static method of express-status
Example

function(req, res){
 res.serviceUnavailable().end();
}

express-status.gatewayTimeout()

sets res status code to 504

Kind: static method of express-status
Example

function(req, res){
 res.gatewayTimeout().end();
}

express-status.httpVersionNutSupported()

sets res status code to 505

Kind: static method of express-status
Example

function(req, res){
 res.httpVersionNutSupported().end();
}

express-status.variantAlsoNegotiates()

sets res status code to 506

Kind: static method of express-status
Example

function(req, res){
 res.variantAlsoNegotiates().end();
}

express-status.insufficientStorage()

sets res status code to 507

Kind: static method of express-status
Example

function(req, res){
 res.insufficientStorage().end();
}

express-status.loopDetected()

sets res status code to 508

Kind: static method of express-status
Example

function(req, res){
 res.loopDetected().end();
}

express-status.notExtended()

sets res status code to 510

Kind: static method of express-status
Example

function(req, res){
 res.notExtended().end();
}

express-status.networkAuthenticationRequired()

sets res status code to 511

Kind: static method of express-status
Example

function(req, res){
 res.notExtended().end();
}

Keywords

FAQs

Package last updated on 08 Jun 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc