Remove middleware default
This commit is contained in:
parent
c8a621a953
commit
4cac9e3d92
4 changed files with 14 additions and 6 deletions
|
@ -1,3 +1,6 @@
|
|||
# 3.0.6
|
||||
* Remove static default values for `middleware`.
|
||||
|
||||
# 3.0.5
|
||||
* Add `MiddlewarePipelineIterator`.
|
||||
|
||||
|
|
|
@ -72,7 +72,9 @@ abstract class _BrowserRouterImpl<T> extends Router<T>
|
|||
all(path, handler, middleware: middleware);
|
||||
|
||||
void prepareAnchors() {
|
||||
final anchors = window.document.querySelectorAll('a'); //:not([dynamic])');
|
||||
final anchors = window.document
|
||||
.querySelectorAll('a')
|
||||
.cast<AnchorElement>(); //:not([dynamic])');
|
||||
|
||||
for (final AnchorElement $a in anchors) {
|
||||
if ($a.attributes.containsKey('href') &&
|
||||
|
|
|
@ -69,7 +69,8 @@ class Router<T> {
|
|||
/// for requests with the given method (case-insensitive).
|
||||
/// Provide '*' as the method to respond to all methods.
|
||||
Route<T> addRoute(String method, String path, T handler,
|
||||
{Iterable<T> middleware: const []}) {
|
||||
{Iterable<T> middleware}) {
|
||||
middleware ??= <T>[];
|
||||
if (_useCache == true)
|
||||
throw new StateError('Cannot add routes after caching is enabled.');
|
||||
|
||||
|
@ -164,7 +165,8 @@ class Router<T> {
|
|||
/// Returns the created route.
|
||||
/// You can also register middleware within the router.
|
||||
SymlinkRoute<T> group(String path, void callback(Router<T> router),
|
||||
{Iterable<T> middleware: const [], String name: null}) {
|
||||
{Iterable<T> middleware, String name: null}) {
|
||||
middleware ??= <T>[];
|
||||
final router = new Router<T>().._middleware.addAll(middleware);
|
||||
callback(router);
|
||||
return mount(path, router)..name = name;
|
||||
|
@ -402,15 +404,16 @@ class _ChainedRouter<T> extends Router<T> {
|
|||
|
||||
@override
|
||||
Route<T> addRoute(String method, String path, handler,
|
||||
{Iterable<T> middleware: const []}) {
|
||||
{Iterable<T> middleware}) {
|
||||
var route = super.addRoute(method, path, handler,
|
||||
middleware: []..addAll(_handlers)..addAll(middleware ?? []));
|
||||
//_root._routes.add(route);
|
||||
return route;
|
||||
}
|
||||
|
||||
@override
|
||||
SymlinkRoute<T> group(String path, void callback(Router<T> router),
|
||||
{Iterable<T> middleware: const [], String name: null}) {
|
||||
{Iterable<T> middleware, String name: null}) {
|
||||
final router =
|
||||
new _ChainedRouter<T>(_root, []..addAll(_handlers)..addAll(middleware));
|
||||
callback(router);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_route
|
||||
description: A powerful, isomorphic routing library for Dart. It is mainly used in the Angel framework, but can be used in Flutter and on the Web.
|
||||
version: 3.0.5
|
||||
version: 3.0.6
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_route
|
||||
environment:
|
||||
|
|
Loading…
Reference in a new issue