2.0.0-alpha.20

This commit is contained in:
Tobe O 2019-02-03 11:03:31 -05:00
parent 3f9e94b12a
commit b0ecac3232
4 changed files with 18 additions and 12 deletions

View file

@ -1,3 +1,6 @@
# 2.0.0-alpha.20
* Inject the `MiddlewarePipeline` into requests.
# 2.0.0-alpha.19 # 2.0.0-alpha.19
* `parseBody` checks for null content type, and throws a `400` if none was given. * `parseBody` checks for null content type, and throws a `400` if none was given.
* Add `ResponseContext.contentLength`. * Add `ResponseContext.contentLength`.

View file

@ -97,17 +97,18 @@ abstract class Driver<
var path = req.path; var path = req.path;
if (path == '/') path = ''; if (path == '/') path = '';
Tuple3<List, Map<String, dynamic>, ParseResult<Map<String, dynamic>>> Tuple4<List, Map<String, dynamic>, ParseResult<Map<String, dynamic>>,
resolveTuple() { MiddlewarePipeline> resolveTuple() {
Router r = app.optimizedRouter; Router r = app.optimizedRouter;
var resolved = var resolved =
r.resolveAbsolute(path, method: req.method, strip: false); r.resolveAbsolute(path, method: req.method, strip: false);
var pipeline = new MiddlewarePipeline(resolved);
return new Tuple3( return new Tuple4(
new MiddlewarePipeline(resolved).handlers, pipeline.handlers,
resolved.fold<Map<String, dynamic>>( resolved.fold<Map<String, dynamic>>(
<String, dynamic>{}, (out, r) => out..addAll(r.allParams)), <String, dynamic>{}, (out, r) => out..addAll(r.allParams)),
resolved.isEmpty ? null : resolved.first.parseResult, resolved.isEmpty ? null : resolved.first.parseResult,
pipeline,
); );
} }
@ -118,9 +119,10 @@ abstract class Driver<
req.params.addAll(tuple.item2); req.params.addAll(tuple.item2);
req.container.registerSingleton<ParseResult<Map<String, dynamic>>>( req.container
tuple.item3); ..registerSingleton<MiddlewarePipeline>(tuple.item4)
req.container.registerSingleton<ParseResult>(tuple.item3); ..registerSingleton<ParseResult<Map<String, dynamic>>>(tuple.item3)
..registerSingleton<ParseResult>(tuple.item3);
if (!app.isProduction && app.logger != null) { if (!app.isProduction && app.logger != null) {
req.container req.container

View file

@ -36,9 +36,10 @@ class Angel extends Routable {
(String view, [Map data]) => 'No view engine has been configured yet.'; (String view, [Map data]) => 'No view engine has been configured yet.';
final List<Angel> _children = []; final List<Angel> _children = [];
final Map<String, final Map<
Tuple3<List, Map<String, dynamic>, ParseResult<Map<String, dynamic>>>> String,
handlerCache = new HashMap(); Tuple4<List, Map<String, dynamic>, ParseResult<Map<String, dynamic>>,
MiddlewarePipeline>> handlerCache = new HashMap();
Router _flattened; Router _flattened;
bool _isProduction; bool _isProduction;

View file

@ -1,5 +1,5 @@
name: angel_framework name: angel_framework
version: 2.0.0-alpha.19 version: 2.0.0-alpha.20
description: A high-powered HTTP server with dependency injection, routing and much more. description: A high-powered HTTP server with dependency injection, routing and much more.
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