express-validation
Advanced tools
Comparing version 0.2.4 to 0.3.0
'use strict'; | ||
var Joi = require('joi') | ||
, _ = require('underscore'); | ||
, _ = require('lodash'); | ||
@@ -81,4 +81,4 @@ module.exports = function (schema) { | ||
return res.status(options.status).json(response); | ||
return next(response); | ||
}; | ||
}; |
{ | ||
"name": "express-validation", | ||
"version": "0.2.4", | ||
"version": "0.3.0", | ||
"author": "Andrew Keig <andrew.keig@gmail.com>", | ||
"description": "express-validation is a middleware that validates the body, params, query, headers of a request and returns a 400 Bad request response; with errors; if any of the configured validation rules fail.", | ||
"description": "express-validation is a middleware that validates the body, params, query, headers of a request and returns a response with errors; if any of the configured validation rules fail.", | ||
"homepage": "https://github.com/andrewkeig/express-validation", | ||
@@ -12,4 +12,4 @@ "repository": { | ||
"dependencies": { | ||
"joi": "4.0.0", | ||
"underscore": "*" | ||
"joi": "^4.7.0", | ||
"lodash": "^2.4.1" | ||
}, | ||
@@ -16,0 +16,0 @@ "devDependencies": { |
express-validation | ||
================== | ||
express-validation is a middleware that validates the body, params, query, headers of a request and returns a 400 Bad request response; with errors; if any of the configured validation rules fail. | ||
express-validation is a middleware that validates the body, params, query, headers of a request and returns a response with errors; if any of the configured validation rules fail. | ||
@@ -27,2 +27,4 @@ [![build status](https://travis-ci.org/AndrewKeig/express-validation.svg)](http://travis-ci.org/andrewkeig/express-validation) | ||
####Note: prior to version 0.3.0, we returned a json error response straight out of the middleware, this changed in 0.3.0, so you will need to add an express error handler. | ||
``` | ||
@@ -34,3 +36,3 @@ var express = require('express') | ||
, app = express(); | ||
I | ||
app.use(express.bodyParser()); | ||
@@ -43,2 +45,7 @@ app.set('port', 3000); | ||
//error handler, required as of 0.3.0 | ||
app.use(function(err, req, res, next){ | ||
res.status(400).json(err); | ||
}); | ||
http.createServer(app); | ||
@@ -45,0 +52,0 @@ ``` |
@@ -42,3 +42,7 @@ 'use strict'; | ||
app.use(function(err, req, res, next){ | ||
res.status(400).json(err); | ||
}); | ||
http.createServer(app); | ||
module.exports = app; |
@@ -37,3 +37,3 @@ 'use strict'; | ||
response.errors.length.should.equal(1); | ||
response.errors[0].messages.length.should.equal(2); | ||
response.errors[0].messages.length.should.equal(1); | ||
done(); | ||
@@ -40,0 +40,0 @@ }); |
@@ -101,3 +101,3 @@ 'use strict'; | ||
response.errors.length.should.equal(1); | ||
response.errors[0].messages.length.should.equal(2); | ||
response.errors[0].messages.length.should.equal(1); | ||
response.errors[0].field.should.equal('accesstoken') | ||
@@ -104,0 +104,0 @@ done(); |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
23976
512
0
162
+ Addedlodash@^2.4.1
+ Addedisemail@1.2.0(transitive)
+ Addedjoi@4.9.0(transitive)
+ Addedlodash@2.4.2(transitive)
+ Addedmoment@2.30.1(transitive)
- Removedunderscore@*
- Removedjoi@4.0.0(transitive)
- Removedunderscore@1.13.7(transitive)
Updatedjoi@^4.7.0