diff --git a/README.md b/README.md index 389b8730..b9302035 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # validate -[![version 1.0.2+3](https://img.shields.io/badge/pub-v1.0.2+3-brightgreen.svg)](https://pub.dartlang.org/packages/angel_validate) +[![version 1.0.2+4](https://img.shields.io/badge/pub-v1.0.2+4-brightgreen.svg)](https://pub.dartlang.org/packages/angel_validate) [![build status](https://travis-ci.org/angel-dart/validate.svg)](https://travis-ci.org/angel-dart/validate) [Live Example](https://angel-dart.github.io/validate) diff --git a/lib/server.dart b/lib/server.dart index 5fdbf0db..f0b8f0e5 100644 --- a/lib/server.dart +++ b/lib/server.dart @@ -16,7 +16,7 @@ RequestMiddleware autoParseBody(List fields) { /// Auto-parses numbers in `req.query`. RequestMiddleware autoParseQuery(List fields) { return (RequestContext req, res) async { - (await req.lazyQuery()).addAll(autoParse(req.query, fields)); + req.query.addAll(autoParse(req.query, fields)); return true; }; } @@ -35,7 +35,7 @@ RequestMiddleware filterBody(Iterable only) { /// Filters unwanted data out of `req.query`. RequestMiddleware filterQuery(Iterable only) { return (RequestContext req, res) async { - var filtered = filter(await req.lazyQuery(), only); + var filtered = filter(req.query, only); req.query ..clear() ..addAll(filtered); @@ -48,7 +48,7 @@ RequestMiddleware filterQuery(Iterable only) { RequestMiddleware validate(Validator validator, {String errorMessage: 'Invalid data.'}) { return (RequestContext req, res) async { - var result = validator.check(req.body); + var result = validator.check(await req.lazyBody()); if (result.errors.isNotEmpty) { throw new AngelHttpException.badRequest( diff --git a/pubspec.yaml b/pubspec.yaml index 25d388b5..8ee46b08 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: angel_validate description: Cross-platform validation library based on `matcher`. -version: 1.0.2+3 +version: 1.0.2+4 author: Tobe O homepage: https://github.com/angel-dart/validate environment: