diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d2b51d8d..c760e7a9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -92,8 +92,8 @@ - - + + @@ -141,8 +141,8 @@ - - + + @@ -291,8 +291,8 @@ @@ -700,14 +700,7 @@ - - - - 1481378740441 - 1481379127310 @@ -1045,7 +1038,14 @@ - - - + + @@ -1548,8 +1548,8 @@ - - + + diff --git a/lib/src/http/angel_http.dart b/lib/src/http/angel_http.dart index 2b8f3da2..7182ff45 100644 --- a/lib/src/http/angel_http.dart +++ b/lib/src/http/angel_http.dart @@ -218,7 +218,7 @@ class AngelHttp { [RequestContext correspondingRequest]) => new Future.value( new ResponseContext(response, app, correspondingRequest) - ..serializer = (_serializer ?? god.serialize) + ..serializer = (app.serializer ?? god.serialize) ..encoders.addAll(app.encoders ?? {})); /// Limits the maximum number of requests to be handled concurrently by this instance. diff --git a/lib/src/http/server.dart b/lib/src/http/server.dart index 5f590372..459cda83 100644 --- a/lib/src/http/server.dart +++ b/lib/src/http/server.dart @@ -11,7 +11,6 @@ export 'package:container/container.dart'; import 'package:json_god/json_god.dart' as god; import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; -import 'package:pool/pool.dart'; import 'package:tuple/tuple.dart'; import 'angel_base.dart'; import 'angel_http.dart'; @@ -53,7 +52,9 @@ class Angel extends AngelBase { createZoneForRequest; final Map _preContained = {}; - ResponseSerializer _serializer; + + /// A middleware to inject a serialize on every request. + ResponseSerializer serializer; /// A [Map] of dependency data obtained via reflection. /// @@ -277,10 +278,10 @@ class Angel extends AngelBase { this.encoders.addAll(encoders); } - /// Shortcut for adding a middleware to inject a serialize on every request. + /// Prefer directly setting [serializer]. + @deprecated void injectSerializer(ResponseSerializer serializer) { - // TODO: Make this public - _serializer = serializer; + this.serializer = serializer; } Future getHandlerResult(