fix async resolutions

This commit is contained in:
Tobe O 2019-04-17 15:34:30 -04:00
parent ef8e343ccd
commit 3a9bd27d6d
2 changed files with 5 additions and 4 deletions

View file

@ -68,12 +68,13 @@ resolveInjection(requirement, InjectionRequest injection, RequestContext req,
} else if (requirement is Type && requirement != dynamic) { } else if (requirement is Type && requirement != dynamic) {
try { try {
var futureType = container.reflector.reflectFutureOf(requirement); var futureType = container.reflector.reflectFutureOf(requirement);
return await container.make(futureType.reflectedType); if (container.has(futureType.reflectedType))
return await container.make(futureType.reflectedType);
} on UnsupportedError { } on UnsupportedError {
// Ignore this; it just means that the reflector doesn't support futures. // Ignore.
} }
return container.make(requirement); return await container.make(requirement);
} else if (throwOnUnresolved) { } else if (throwOnUnresolved) {
throw new ArgumentError( throw new ArgumentError(
'$requirement cannot be injected into a request handler.'); '$requirement cannot be injected into a request handler.');

View file

@ -6,7 +6,7 @@ homepage: https://github.com/angel-dart/angel_framework
environment: environment:
sdk: ">=2.0.0-dev <3.0.0" sdk: ">=2.0.0-dev <3.0.0"
dependencies: dependencies:
angel_container: ^1.0.0-alpha angel_container: ^1.0.4
angel_http_exception: ^1.0.0 angel_http_exception: ^1.0.0
angel_model: ^1.0.0 angel_model: ^1.0.0
angel_route: ^3.0.0 angel_route: ^3.0.0