lazyBody
This commit is contained in:
parent
10a7012987
commit
447aeb833e
3 changed files with 5 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -16,7 +16,7 @@ RequestMiddleware autoParseBody(List<String> fields) {
|
|||
/// Auto-parses numbers in `req.query`.
|
||||
RequestMiddleware autoParseQuery(List<String> 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<String> only) {
|
|||
/// Filters unwanted data out of `req.query`.
|
||||
RequestMiddleware filterQuery(Iterable<String> 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<String> 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(
|
||||
|
|
|
@ -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 <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/validate
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue