diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index 5a47d8a9..420fa01a 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -97,10 +97,9 @@ class Angel extends AngelBase { /// /// Returns false on failure; otherwise, returns the HttpServer. Future startServer([InternetAddress address, int port]) async { - var server = await _serverGenerator( - address ?? InternetAddress.LOOPBACK_IP_V4, port ?? 0); - this.httpServer = server; - return server..listen(handleRequest); + final host = address ?? InternetAddress.LOOPBACK_IP_V4; + final server = await _serverGenerator(host, port ?? 0); + return this.httpServer = server..listen(handleRequest); } /// Loads some base dependencies into the service container. @@ -185,8 +184,7 @@ class Angel extends AngelBase { if (requestedUrl.isEmpty) requestedUrl = '/'; - final route = resolve(requestedUrl, - (route) => route.method == request.method || route.method == '*'); + final route = resolve(requestedUrl, method: request.method); print('Resolve ${requestedUrl} -> $route'); req.params.addAll(route?.parseParameters(requestedUrl) ?? {}); diff --git a/pubspec.yaml b/pubspec.yaml index b2431cab..0d1e5031 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,14 +3,16 @@ version: 1.0.0-dev.22 description: Core libraries for the Angel framework. author: Tobe O homepage: https://github.com/angel-dart/angel_framework +environment: + sdk: ">=1.18.0" dependencies: angel_route: path: ../angel_route - body_parser: ">=1.0.0-dev <2.0.0" - container: ">=0.1.2 <1.0.0" - json_god: ">=2.0.0-beta <3.0.0" - merge_map: ">=1.0.0 <2.0.0" - mime: ">=0.9.3 <1.0.0" + body_parser: ^1.0.0-dev + container: ^0.1.2 + json_god: ^2.0.0-beta + merge_map: ^1.0.0 + mime: ^0.9.3 dev_dependencies: - http: ">= 0.11.3 <0.12.0" - test: ">= 0.12.13 <0.13.0" \ No newline at end of file + http: ^0.11.3 + test: ^0.12.13 diff --git a/test/controller.dart b/test/controller.dart index c85a9037..8af37c83 100644 --- a/test/controller.dart +++ b/test/controller.dart @@ -52,7 +52,7 @@ main() { }); tearDown(() async { - await server.close(force: true); + await (server ?? app.httpServer).close(force: true); client.close(); client = null; });