express-status
v1.0.10
Published
status code response helper
Downloads
447
Maintainers
Readme
express-status
Extends express response prototype with status codes helper methods.
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
- .switchingProtocols()
- .processing()
- .ok()
- .created()
- .accepted()
- .nonAuthoritative()
- .noContent()
- .resetContent()
- .partialContent()
- .multiStatus()
- .alreadyReported()
- .imUsed()
- .multipleChoices()
- .movedPermanently()
- .found()
- .seeOther()
- .notModified()
- .useProxy()
- .switchProxy()
- .temporaryRedirect()
- .permanentRedirect()
- .badRequest()
- .unauthorized()
- .forbidden()
- .notFound()
- .methodNotAllowed()
- .notAcceptable()
- .proxyAuthenticationRequired()
- .requestTimeout()
- .conflict()
- .gone()
- .lengthRequired()
- .preconditionFailed()
- .requestEntityTooLarge()
- .requestUriTooLang()
- .unsupportedMediaType()
- .requestedRangeNotSatisfiable()
- .expectationFailed()
- .imATeapot()
- .authenticationTimeout()
- .locked()
- .failedDependency()
- .upgradeRequired()
- .preconditionRequired()
- .tooManyRequests()
- .requestHeaderFieldTooLarge()
- .loginTimeout()
- .unavailableForLegalReasons()
- .internalServerError()
- .notImplemented()
- .badGateway()
- .serviceUnavailable()
- .gatewayTimeout()
- .httpVersionNutSupported()
- .variantAlsoNegotiates()
- .insufficientStorage()
- .loopDetected()
- .notExtended()
- .networkAuthenticationRequired()
express-status.switchingProtocols()
sets res status code to 101
Kind: static method of express-status
Example
function(req, res){
res.switchingProtocols().end();
}
express-status.processing()
sets res status code to 102
Kind: static method of express-status
Example
function(req, res){
res.processing().end();
}
express-status.ok()
sets res status code to 200
Kind: static method of express-status
Example
function(req, res){
res.ok().end();
}
express-status.created()
sets res status code to 201
Kind: static method of express-status
Example
function(req, res){
res.created().end();
}
express-status.accepted()
sets res status code to 202
Kind: static method of express-status
Example
function(req, res){
res.accepted().end();
}
express-status.nonAuthoritative()
sets res status code to 203
Kind: static method of express-status
Example
function(req, res){
res.nonAuthoritative().end();
}
express-status.noContent()
sets res status code to 204
Kind: static method of express-status
Example
function(req, res){
res.noContent().end();
}
express-status.resetContent()
sets res status code to 205
Kind: static method of express-status
Example
function(req, res){
res.resetContent().end();
}
express-status.partialContent()
sets res status code to 206
Kind: static method of express-status
Example
function(req, res){
res.partialContent().end();
}
express-status.multiStatus()
sets res status code to 207
Kind: static method of express-status
Example
function(req, res){
res.multiStatus().end();
}
express-status.alreadyReported()
sets res status code to 208
Kind: static method of express-status
Example
function(req, res){
res.alreadyReported().end();
}
express-status.imUsed()
sets res status code to 226
Kind: static method of express-status
Example
function(req, res){
res.imUsed().end();
}
express-status.multipleChoices()
sets res status code to 300
Kind: static method of express-status
Example
function(req, res){
res.multipleChoices().end();
}
express-status.movedPermanently()
sets res status code to 301
Kind: static method of express-status
Example
function(req, res){
res.movedPermanently().end();
}
express-status.found()
sets res status code to 302
Kind: static method of express-status
Example
function(req, res){
res.found().end();
}
express-status.seeOther()
sets res status code to 303
Kind: static method of express-status
Example
function(req, res){
res.seeOther().end();
}
express-status.notModified()
sets res status code to 304
Kind: static method of express-status
Example
function(req, res){
res.notModified().end();
}
express-status.useProxy()
sets res status code to 305
Kind: static method of express-status
Example
function(req, res){
res.useProxy().end();
}
express-status.switchProxy()
sets res status code to 306
Kind: static method of express-status
Example
function(req, res){
res.switchProxy().end();
}
express-status.temporaryRedirect()
sets res status code to 307
Kind: static method of express-status
Example
function(req, res){
res.temporaryRedirect().end();
}
express-status.permanentRedirect()
sets res status code to 308
Kind: static method of express-status
Example
function(req, res){
res.permanentRedirect().end();
}
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();
}