diff --git a/README.md b/README.md index b3e8ca45..40e4665b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_framework -[![pub 1.0.0-dev.62](https://img.shields.io/badge/pub-1.0.0--dev.62-red.svg)](https://pub.dartlang.org/packages/angel_framework) +[![pub 1.0.0-dev.63](https://img.shields.io/badge/pub-1.0.0--dev.63-red.svg)](https://pub.dartlang.org/packages/angel_framework) [![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework) Core libraries for the Angel Framework. diff --git a/lib/hooks.dart b/lib/hooks.dart index 4364f8a7..a9887dfc 100644 --- a/lib/hooks.dart +++ b/lib/hooks.dart @@ -66,7 +66,7 @@ HookedServiceEventListener toType(Type type) { /// Removes one or more [key]s from `e.data` or `e.result`. /// Works on single objects and iterables. -HookedServiceEventListener remove(key, remover(key, obj)) { +HookedServiceEventListener remove(key, [remover(key, obj)]) { return (HookedServiceEvent e) async { if (!e.isAfter) throw new StateError("'remove' only works on after hooks."); diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index 10c1476c..0c1f1ce9 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -81,8 +81,8 @@ class Angel extends AngelBase { /// These will only not run if an [AngelFatalError] occurs. final List responseFinalizers = []; - /// Default error handler, show HTML error page - AngelErrorHandler _errorHandler = + /// The handler currently configured to run on [AngelHttpException]s. + AngelErrorHandler errorHandler = (AngelHttpException e, req, ResponseContext res) { res.headers[HttpHeaders.CONTENT_TYPE] = ContentType.HTML.toString(); res.statusCode = e.statusCode; @@ -97,9 +97,6 @@ class Angel extends AngelBase { res.end(); }; - /// The handler currently configured to run on [AngelHttpException]s. - AngelErrorHandler get errorHandler => _errorHandler; - /// [RequestMiddleware] to be run before all requests. final List before = []; @@ -225,8 +222,7 @@ class Angel extends AngelBase { if (requestedUrl.isEmpty) requestedUrl = '/'; - var resolved = - resolveAll(requestedUrl, requestedUrl, method: req.method); + var resolved = resolveAll(requestedUrl, requestedUrl, method: req.method); for (var result in resolved) req.params.addAll(result.allParams); @@ -452,8 +448,9 @@ class Angel extends AngelBase { } /// Registers a callback to run upon errors. + @deprecated onError(AngelErrorHandler handler) { - _errorHandler = handler; + this.errorHandler = handler; } /// Default constructor. ;) diff --git a/lib/src/http/typed_service.dart b/lib/src/http/typed_service.dart index f6612ed4..eb883119 100644 --- a/lib/src/http/typed_service.dart +++ b/lib/src/http/typed_service.dart @@ -24,9 +24,7 @@ class TypedService extends Service { var value = x[key]; if ((key == 'createdAt' || key == 'updatedAt') && value is String) { - return map..[key] = DateTime.parse(value).toIso8601String(); - } else if (value is DateTime) { - return map..[key] = value.toIso8601String(); + return map..[key] = DateTime.parse(value); } else { return map..[key] = value; } diff --git a/pubspec.yaml b/pubspec.yaml index e58a0142..26a1b696 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_framework -version: 1.0.0-dev.62 +version: 1.0.0-dev.63 description: Core libraries for the Angel framework. author: Tobe O homepage: https://github.com/angel-dart/angel_framework