diff --git a/README.md b/README.md index c88f7602..2d31d818 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_route -![version 1.0.0-dev+19](https://img.shields.io/badge/version-1.0.0--dev+19-red.svg) +![version 1.0.0](https://img.shields.io/badge/version-1.0.0-brightgreen.svg) ![build status](https://travis-ci.org/angel-dart/route.svg) A powerful, isomorphic routing library for Dart. diff --git a/lib/src/router.dart b/lib/src/router.dart index a02740ff..f8145891 100644 --- a/lib/src/router.dart +++ b/lib/src/router.dart @@ -59,6 +59,8 @@ class Router extends Extensible { /// Prepends the given middleware to any routes created /// by the resulting router. + /// + /// [middleware] can be either an `Iterable`, or a single object. /// /// The resulting router can be chained, too. _ChainedRouter chain(middleware) => new _ChainedRouter(this, middleware); @@ -412,7 +414,7 @@ class _ChainedRouter extends Router { _ChainedRouter(Router root, middleware) { this._root = root; - _handlers.add(middleware); + _handlers.addAll(middleware is Iterable ? middleware : [middleware]); } @override @@ -436,7 +438,7 @@ class _ChainedRouter extends Router { final piped = new _ChainedRouter.empty().._root = _root; piped._handlers.addAll([] ..addAll(_handlers) - ..add(middleware)); + ..addAll(middleware is Iterable ? middleware : [middleware])); return piped; } } diff --git a/pubspec.yaml b/pubspec.yaml index 43fe86ad..1cbe3317 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: angel_route description: A powerful, isomorphic routing library for Dart. -version: 1.0.0-dev+19 +version: 1.0.0 author: Tobe O homepage: https://github.com/angel-dart/angel_route dev_dependencies: