diff --git a/CHANGELOG.md b/CHANGELOG.md index c3ad2615..1a9399c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ * Upgrade `http2` dependency. * Upgrade `uuid` dependency. * Fixed a bug that prevented body parsing from ever completing with `http2`. +* Add `Providers.hashCode`. # 2.0.0-alpha.17 * Revert the migration to `lumberjack` for now. In the future, when it's more diff --git a/lib/src/core/controller.dart b/lib/src/core/controller.dart index 65cf262f..c30c05fc 100644 --- a/lib/src/core/controller.dart +++ b/lib/src/core/controller.dart @@ -23,7 +23,7 @@ class Controller { /// A mapping of route paths to routes, produced from the [Expose] annotations on this class. Map routeMappings = {}; - Controller({this.injectSingleton: true}); + Controller({this.injectSingleton = true}); @mustCallSuper Future configureServer(Angel app) { diff --git a/lib/src/core/driver.dart b/lib/src/core/driver.dart index 5580f01a..794ff02a 100644 --- a/lib/src/core/driver.dart +++ b/lib/src/core/driver.dart @@ -26,7 +26,7 @@ abstract class Driver< /// The function used to bind this instance to a server.. final Future Function(dynamic, int) serverGenerator; - Driver(this.app, this.serverGenerator, {this.useZone: true}); + Driver(this.app, this.serverGenerator, {this.useZone = true}); /// The path at which this server is listening for requests. Uri get uri; @@ -250,7 +250,7 @@ abstract class Driver< ResponseContext res, Request request, Response response, - {bool ignoreFinalizers: false}) { + {bool ignoreFinalizers = false}) { if (req == null || res == null) { try { app.logger?.severe(null, e, st); @@ -281,7 +281,7 @@ abstract class Driver< /// Sends a response. Future sendResponse(Request request, Response response, RequestContext req, ResponseContext res, - {bool ignoreFinalizers: false}) { + {bool ignoreFinalizers = false}) { void _cleanup(_) { if (!app.isProduction && app.logger != null) { var sw = req.container.make(); diff --git a/lib/src/core/service.dart b/lib/src/core/service.dart index a330b0d7..755fb6b1 100644 --- a/lib/src/core/service.dart +++ b/lib/src/core/service.dart @@ -1,10 +1,9 @@ library angel_framework.http.service; import 'dart:async'; - import 'package:angel_http_exception/angel_http_exception.dart'; import 'package:merge_map/merge_map.dart'; - +import 'package:quiver_hashcode/hashcode.dart'; import '../util.dart'; import 'anonymous_service.dart'; import 'hooked_service.dart' show HookedService; @@ -36,6 +35,9 @@ class Providers { /// Represents a request parsed from GraphQL. static const Providers graphQL = Providers(viaGraphQL); + @override + int get hashCode => hashObjects([via]); + @override bool operator ==(other) => other is Providers && other.via == via; diff --git a/pubspec.yaml b/pubspec.yaml index 2513fadc..a3380ed4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: mime: ^0.9.3 mock_request: ^1.0.0 path: ^1.0.0 + quiver_hashcode: ^2.0.0 stack_trace: ^1.0.0 tuple: ^1.0.0 uuid: ^2.0.0-rc.1