From 7586b4c58eaf69b71909b4cdaaafec2a80738879 Mon Sep 17 00:00:00 2001 From: thosakwe Date: Sat, 25 Feb 2017 15:57:28 -0500 Subject: [PATCH] 59 --- README.md | 2 +- lib/src/http/request_context.dart | 2 +- lib/src/http/server.dart | 6 ++---- pubspec.yaml | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 709a7ddf..3ae84724 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # angel_framework -[![pub 1.0.0-dev.58](https://img.shields.io/badge/pub-1.0.0--dev.58-red.svg)](https://pub.dartlang.org/packages/angel_framework) +[![pub 1.0.0-dev.59](https://img.shields.io/badge/pub-1.0.0--dev.59-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/src/http/request_context.dart b/lib/src/http/request_context.dart index 1976f23b..23dc7284 100644 --- a/lib/src/http/request_context.dart +++ b/lib/src/http/request_context.dart @@ -103,7 +103,7 @@ class RequestContext extends Extensible { /// Grabs an object by key or type from [params], [injections], or /// [app].container. Use this to perform dependency injection /// within a service hook. - grab(key) { + T grab(key) { if (params.containsKey(key)) return params[key]; else if (injections.containsKey(key)) diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index be412695..014c443b 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -27,9 +27,6 @@ typedef Future AngelErrorHandler( /// A function that configures an [Angel] server in some way. typedef Future AngelConfigurer(Angel app); -/// A function that takes no parameters. -typedef ParameterlessFunction(); - /// A powerful real-time/REST/MVC server class. class Angel extends AngelBase { StreamController _afterProcessed = @@ -491,10 +488,11 @@ class Angel extends AngelBase { /// Predetermines what needs to be injected for a handler to run. InjectionRequest preInject(Function handler) { var injection = new InjectionRequest(); - if (handler is ParameterlessFunction) return injection; ClosureMirror closureMirror = reflect(handler); + if (closureMirror.function.parameters.isEmpty) return injection; + // Load parameters for (var parameter in closureMirror.function.parameters) { var name = MirrorSystem.getName(parameter.simpleName); diff --git a/pubspec.yaml b/pubspec.yaml index dba3746a..15af350d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_framework -version: 1.0.0-dev.58 +version: 1.0.0-dev.59 description: Core libraries for the Angel framework. author: Tobe O homepage: https://github.com/angel-dart/angel_framework