63
This commit is contained in:
parent
013968336c
commit
8d4c169b4e
5 changed files with 9 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
||||||
# angel_framework
|
# 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)
|
[![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework)
|
||||||
|
|
||||||
Core libraries for the Angel Framework.
|
Core libraries for the Angel Framework.
|
||||||
|
|
|
@ -66,7 +66,7 @@ HookedServiceEventListener toType(Type type) {
|
||||||
|
|
||||||
/// Removes one or more [key]s from `e.data` or `e.result`.
|
/// Removes one or more [key]s from `e.data` or `e.result`.
|
||||||
/// Works on single objects and iterables.
|
/// Works on single objects and iterables.
|
||||||
HookedServiceEventListener remove(key, remover(key, obj)) {
|
HookedServiceEventListener remove(key, [remover(key, obj)]) {
|
||||||
return (HookedServiceEvent e) async {
|
return (HookedServiceEvent e) async {
|
||||||
if (!e.isAfter) throw new StateError("'remove' only works on after hooks.");
|
if (!e.isAfter) throw new StateError("'remove' only works on after hooks.");
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ class Angel extends AngelBase {
|
||||||
/// These will only not run if an [AngelFatalError] occurs.
|
/// These will only not run if an [AngelFatalError] occurs.
|
||||||
final List<RequestHandler> responseFinalizers = [];
|
final List<RequestHandler> responseFinalizers = [];
|
||||||
|
|
||||||
/// Default error handler, show HTML error page
|
/// The handler currently configured to run on [AngelHttpException]s.
|
||||||
AngelErrorHandler _errorHandler =
|
AngelErrorHandler errorHandler =
|
||||||
(AngelHttpException e, req, ResponseContext res) {
|
(AngelHttpException e, req, ResponseContext res) {
|
||||||
res.headers[HttpHeaders.CONTENT_TYPE] = ContentType.HTML.toString();
|
res.headers[HttpHeaders.CONTENT_TYPE] = ContentType.HTML.toString();
|
||||||
res.statusCode = e.statusCode;
|
res.statusCode = e.statusCode;
|
||||||
|
@ -97,9 +97,6 @@ class Angel extends AngelBase {
|
||||||
res.end();
|
res.end();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The handler currently configured to run on [AngelHttpException]s.
|
|
||||||
AngelErrorHandler get errorHandler => _errorHandler;
|
|
||||||
|
|
||||||
/// [RequestMiddleware] to be run before all requests.
|
/// [RequestMiddleware] to be run before all requests.
|
||||||
final List before = [];
|
final List before = [];
|
||||||
|
|
||||||
|
@ -225,8 +222,7 @@ class Angel extends AngelBase {
|
||||||
|
|
||||||
if (requestedUrl.isEmpty) requestedUrl = '/';
|
if (requestedUrl.isEmpty) requestedUrl = '/';
|
||||||
|
|
||||||
var resolved =
|
var resolved = resolveAll(requestedUrl, requestedUrl, method: req.method);
|
||||||
resolveAll(requestedUrl, requestedUrl, method: req.method);
|
|
||||||
|
|
||||||
for (var result in resolved) req.params.addAll(result.allParams);
|
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.
|
/// Registers a callback to run upon errors.
|
||||||
|
@deprecated
|
||||||
onError(AngelErrorHandler handler) {
|
onError(AngelErrorHandler handler) {
|
||||||
_errorHandler = handler;
|
this.errorHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default constructor. ;)
|
/// Default constructor. ;)
|
||||||
|
|
|
@ -24,9 +24,7 @@ class TypedService<T> extends Service {
|
||||||
var value = x[key];
|
var value = x[key];
|
||||||
|
|
||||||
if ((key == 'createdAt' || key == 'updatedAt') && value is String) {
|
if ((key == 'createdAt' || key == 'updatedAt') && value is String) {
|
||||||
return map..[key] = DateTime.parse(value).toIso8601String();
|
return map..[key] = DateTime.parse(value);
|
||||||
} else if (value is DateTime) {
|
|
||||||
return map..[key] = value.toIso8601String();
|
|
||||||
} else {
|
} else {
|
||||||
return map..[key] = value;
|
return map..[key] = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_framework
|
name: angel_framework
|
||||||
version: 1.0.0-dev.62
|
version: 1.0.0-dev.63
|
||||||
description: Core libraries for the Angel framework.
|
description: Core libraries for the Angel framework.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/angel_framework
|
homepage: https://github.com/angel-dart/angel_framework
|
||||||
|
|
Loading…
Reference in a new issue