add hashcode for providers

This commit is contained in:
Tobe O 2018-12-31 12:12:32 -05:00
parent f1d3808828
commit 63c97d9136
5 changed files with 10 additions and 6 deletions

View file

@ -2,6 +2,7 @@
* Upgrade `http2` dependency. * Upgrade `http2` dependency.
* Upgrade `uuid` dependency. * Upgrade `uuid` dependency.
* Fixed a bug that prevented body parsing from ever completing with `http2`. * Fixed a bug that prevented body parsing from ever completing with `http2`.
* Add `Providers.hashCode`.
# 2.0.0-alpha.17 # 2.0.0-alpha.17
* Revert the migration to `lumberjack` for now. In the future, when it's more * Revert the migration to `lumberjack` for now. In the future, when it's more

View file

@ -23,7 +23,7 @@ class Controller {
/// A mapping of route paths to routes, produced from the [Expose] annotations on this class. /// A mapping of route paths to routes, produced from the [Expose] annotations on this class.
Map<String, Route> routeMappings = {}; Map<String, Route> routeMappings = {};
Controller({this.injectSingleton: true}); Controller({this.injectSingleton = true});
@mustCallSuper @mustCallSuper
Future configureServer(Angel app) { Future configureServer(Angel app) {

View file

@ -26,7 +26,7 @@ abstract class Driver<
/// The function used to bind this instance to a server.. /// The function used to bind this instance to a server..
final Future<Server> Function(dynamic, int) serverGenerator; final Future<Server> 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. /// The path at which this server is listening for requests.
Uri get uri; Uri get uri;
@ -250,7 +250,7 @@ abstract class Driver<
ResponseContext res, ResponseContext res,
Request request, Request request,
Response response, Response response,
{bool ignoreFinalizers: false}) { {bool ignoreFinalizers = false}) {
if (req == null || res == null) { if (req == null || res == null) {
try { try {
app.logger?.severe(null, e, st); app.logger?.severe(null, e, st);
@ -281,7 +281,7 @@ abstract class Driver<
/// Sends a response. /// Sends a response.
Future sendResponse(Request request, Response response, RequestContext req, Future sendResponse(Request request, Response response, RequestContext req,
ResponseContext res, ResponseContext res,
{bool ignoreFinalizers: false}) { {bool ignoreFinalizers = false}) {
void _cleanup(_) { void _cleanup(_) {
if (!app.isProduction && app.logger != null) { if (!app.isProduction && app.logger != null) {
var sw = req.container.make<Stopwatch>(); var sw = req.container.make<Stopwatch>();

View file

@ -1,10 +1,9 @@
library angel_framework.http.service; library angel_framework.http.service;
import 'dart:async'; import 'dart:async';
import 'package:angel_http_exception/angel_http_exception.dart'; import 'package:angel_http_exception/angel_http_exception.dart';
import 'package:merge_map/merge_map.dart'; import 'package:merge_map/merge_map.dart';
import 'package:quiver_hashcode/hashcode.dart';
import '../util.dart'; import '../util.dart';
import 'anonymous_service.dart'; import 'anonymous_service.dart';
import 'hooked_service.dart' show HookedService; import 'hooked_service.dart' show HookedService;
@ -36,6 +35,9 @@ class Providers {
/// Represents a request parsed from GraphQL. /// Represents a request parsed from GraphQL.
static const Providers graphQL = Providers(viaGraphQL); static const Providers graphQL = Providers(viaGraphQL);
@override
int get hashCode => hashObjects([via]);
@override @override
bool operator ==(other) => other is Providers && other.via == via; bool operator ==(other) => other is Providers && other.via == via;

View file

@ -23,6 +23,7 @@ dependencies:
mime: ^0.9.3 mime: ^0.9.3
mock_request: ^1.0.0 mock_request: ^1.0.0
path: ^1.0.0 path: ^1.0.0
quiver_hashcode: ^2.0.0
stack_trace: ^1.0.0 stack_trace: ^1.0.0
tuple: ^1.0.0 tuple: ^1.0.0
uuid: ^2.0.0-rc.1 uuid: ^2.0.0-rc.1