Made Angel.serializer public

This commit is contained in:
Tobe O 2018-02-06 22:48:26 -05:00
parent e2af07c813
commit 37989933c6
3 changed files with 30 additions and 29 deletions

View file

@ -92,8 +92,8 @@
<file leaf-file-name="server.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/src/http/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1684">
<caret line="380" column="7" lean-forward="false" selection-start-line="380" selection-start-column="7" selection-end-line="380" selection-end-column="7" />
<state relative-caret-position="209">
<caret line="58" column="57" lean-forward="true" selection-start-line="58" selection-start-column="57" selection-end-line="58" selection-end-column="57" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
@ -141,8 +141,8 @@
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<state relative-caret-position="192">
<caret line="219" column="5" lean-forward="true" selection-start-line="219" selection-start-column="5" selection-end-line="219" selection-end-column="5" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#1190#1195#0" expanded="false" />
@ -291,8 +291,8 @@
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/src/http/map_service.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/lib/src/http/server.dart" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
</list>
</option>
</component>
@ -700,14 +700,7 @@
<workItem from="1513103483207" duration="18000" />
<workItem from="1513103506825" duration="139000" />
<workItem from="1517332581856" duration="858000" />
<workItem from="1517973177718" duration="2011000" />
</task>
<task id="LOCAL-00002" summary="Core done?">
<created>1481378740441</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1481378740441</updated>
<workItem from="1517973177718" duration="2111000" />
</task>
<task id="LOCAL-00003" summary="Fixed todo">
<created>1481379127310</created>
@ -1045,7 +1038,14 @@
<option name="project" value="LOCAL" />
<updated>1517974351105</updated>
</task>
<option name="localTasksCounter" value="51" />
<task id="LOCAL-00051" summary="Basic server methods transferred to AngelHttp">
<created>1517975212864</created>
<option name="number" value="00051" />
<option name="presentableId" value="LOCAL-00051" />
<option name="project" value="LOCAL" />
<updated>1517975212864</updated>
</task>
<option name="localTasksCounter" value="52" />
<servers />
</component>
<component name="TestHistory">
@ -1081,7 +1081,7 @@
</history-entry>
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="120047000" />
<option name="totallyTimeSpent" value="120147000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -1110,7 +1110,7 @@
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3988604" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Data View" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32763532" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32763532" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3233618" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@ -1119,6 +1119,7 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4002849" sideWeight="0.4964476" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.48005697" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.23141123" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32905984" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@ -1129,7 +1130,6 @@
<window_info id="DB Browser" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32998413" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Coverage" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32905984" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -1140,7 +1140,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="1.0.7+2" />
<MESSAGE value="Working on 1.0.8, including performance tuning" />
<MESSAGE value="Remove reopen" />
<MESSAGE value="1.0.8" />
@ -1165,7 +1164,8 @@
<MESSAGE value="Response no longer closes if `serialize` is called with an empty string" />
<MESSAGE value="Added `autoSnakeCaseNames` to `MapService`" />
<MESSAGE value="Created setup for AngelHttp" />
<option name="LAST_COMMIT_MESSAGE" value="Created setup for AngelHttp" />
<MESSAGE value="Basic server methods transferred to AngelHttp" />
<option name="LAST_COMMIT_MESSAGE" value="Basic server methods transferred to AngelHttp" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
@ -1538,8 +1538,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1684">
<caret line="380" column="7" lean-forward="false" selection-start-line="380" selection-start-column="7" selection-end-line="380" selection-end-column="7" />
<state relative-caret-position="209">
<caret line="58" column="57" lean-forward="true" selection-start-line="58" selection-start-column="57" selection-end-line="58" selection-end-column="57" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
@ -1548,8 +1548,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="0" lean-forward="true" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<state relative-caret-position="192">
<caret line="219" column="5" lean-forward="true" selection-start-line="219" selection-start-column="5" selection-end-line="219" selection-end-column="5" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#1190#1195#0" expanded="false" />

View file

@ -218,7 +218,7 @@ class AngelHttp {
[RequestContext correspondingRequest]) =>
new Future<ResponseContext>.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.

View file

@ -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<dynamic, InjectionRequest> _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(