koa-validator
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -128,3 +128,5 @@ var validator = require('validator') | ||
function updateBody(ctx, name, value){ | ||
return ctx.request.body[name] = value; | ||
// If bodyparser middleware is not used, this will throw an error, | ||
// so check `ctx.request.body` is whether exists | ||
return ctx.request.body && (ctx.request.body[name] = value); | ||
} | ||
@@ -131,0 +133,0 @@ |
{ | ||
"name": "koa-validator", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "a koa port of express-validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -60,3 +60,3 @@ ## koa-validator | ||
### Note | ||
If you will use `checkBody` or `assertBody`, you should use one bodyparse middleware before validator. | ||
If you will use `checkBody` or `assertBody` or `sanitizeBody`, you should use one bodyparse middleware before validator. | ||
@@ -63,0 +63,0 @@ ### Test |
29593
737