This commit is contained in:
thosakwe 2017-06-06 08:42:33 -04:00
parent ae4a434477
commit 67e9150c07
10 changed files with 351 additions and 267 deletions

View file

@ -96,7 +96,7 @@
<entry key="csslib">
<value>
<list>
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.13.7+1/lib" />
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.14.0/lib" />
</list>
</value>
</entry>
@ -124,7 +124,7 @@
<entry key="html">
<value>
<list>
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.1/lib" />
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.2/lib" />
</list>
</value>
</entry>
@ -212,6 +212,13 @@
</list>
</value>
</entry>
<entry key="mock_request">
<value>
<list>
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mock_request-1.0.0/lib" />
</list>
</value>
</entry>
<entry key="package_config">
<value>
<list>
@ -341,7 +348,7 @@
<entry key="test">
<value>
<list>
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-0.12.20+13/lib" />
<option value="$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-0.12.21/lib" />
</list>
</value>
</entry>
@ -396,11 +403,11 @@
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/container-0.1.2/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/convert-2.0.1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/crypto-2.0.1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.13.7+1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.14.0/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flatten-1.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/front_end-0.1.0-alpha.4/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/glob-1.1.3/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.2/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http-0.11.3+13/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_multi_server-2.0.3/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/http_parser-3.1.1/lib" />
@ -413,6 +420,7 @@
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/merge_map-1.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.0.5/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mime-0.9.3/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/mock_request-1.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_config-1.0.1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/package_resolver-1.0.2/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path-1.4.1/lib" />
@ -431,7 +439,7 @@
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stream_channel-1.6.1/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/string_scanner-1.0.2/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/term_glyph-1.0.0/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-0.12.20+13/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/test-0.12.21/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/typed_data-1.1.3/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/utf-0.9.0+3/lib" />
<root url="file://$USER_HOME$/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/watcher-0.9.7+3/lib" />

View file

@ -2,19 +2,16 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/runConfigurations/All_Tests__for_coverage_.xml" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/all.dart" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/precontained_test.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/hooks.dart" afterPath="$PROJECT_DIR$/lib/hooks.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/map_service.dart" afterPath="$PROJECT_DIR$/lib/src/http/map_service.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/response_context.dart" afterPath="$PROJECT_DIR$/lib/src/http/response_context.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/controller.dart" afterPath="$PROJECT_DIR$/lib/src/http/controller.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/routable.dart" afterPath="$PROJECT_DIR$/lib/src/http/routable.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/server.dart" afterPath="$PROJECT_DIR$/lib/src/http/server.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/service.dart" afterPath="$PROJECT_DIR$/lib/src/http/service.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/pubspec.yaml" afterPath="$PROJECT_DIR$/pubspec.yaml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/services_test.dart" afterPath="$PROJECT_DIR$/test/services_test.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/util_test.dart" afterPath="$PROJECT_DIR$/test/util_test.dart" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/all.dart" afterPath="$PROJECT_DIR$/test/all.dart" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
@ -38,21 +35,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446">
<caret line="67" column="32" lean-forward="false" selection-start-line="67" selection-start-column="32" selection-end-line="67" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="map_service.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/map_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-585">
<caret line="20" column="3" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<state relative-caret-position="378">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -60,24 +47,14 @@
</provider>
</entry>
</file>
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="21">
<caret line="1" column="16" lean-forward="false" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="30">
<caret line="2" column="56" lean-forward="false" selection-start-line="2" selection-start-column="56" selection-end-line="2" selection-end-column="56" />
<first_editor relative-caret-position="42">
<caret line="2" column="12" lean-forward="false" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
<folding>
<marker date="1495888771338" expanded="true" signature="432:620" ph="{...}" />
<marker date="1496752945216" expanded="true" signature="428:616" ph="{...}" />
</folding>
</first_editor>
<second_editor />
@ -88,7 +65,7 @@
<file leaf-file-name="hooks.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="547">
<state relative-caret-position="5544">
<caret line="267" column="95" lean-forward="false" selection-start-line="267" selection-start-column="95" selection-end-line="267" selection-end-column="95" />
<folding>
<marker date="1495888340898" expanded="true" signature="318:418" ph="{...}" />
@ -97,33 +74,73 @@
</provider>
</entry>
</file>
<file leaf-file-name="all.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/all.dart">
<file leaf-file-name="service.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="19" column="27" lean-forward="false" selection-start-line="19" selection-start-column="27" selection-end-line="19" selection-end-column="27" />
<folding>
<element signature="e#0#44#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="controller_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="720">
<caret line="70" column="2" lean-forward="false" selection-start-line="70" selection-start-column="2" selection-end-line="70" selection-end-column="2" />
<state relative-caret-position="651">
<caret line="39" column="86" lean-forward="false" selection-start-line="39" selection-start-column="86" selection-end-line="39" selection-end-column="86" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="service.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/service.dart">
<file leaf-file-name="precontained_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="237">
<caret line="84" column="13" lean-forward="true" selection-start-line="84" selection-start-column="13" selection-end-line="84" selection-end-column="13" />
<state relative-caret-position="399">
<caret line="19" column="33" lean-forward="false" selection-start-line="19" selection-start-column="33" selection-end-line="19" selection-end-column="33" />
<folding>
<element signature="e#0#22#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="17" column="22" lean-forward="false" selection-start-line="17" selection-start-column="22" selection-end-line="17" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="313">
<caret line="286" column="5" lean-forward="true" selection-start-line="286" selection-start-column="5" selection-end-line="286" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="routable.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="305">
<caret line="125" column="45" lean-forward="false" selection-start-line="125" selection-start-column="45" selection-end-line="125" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="controller.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="485">
<caret line="164" column="37" lean-forward="false" selection-start-line="164" selection-start-column="37" selection-end-line="164" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="request_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="284">
<caret line="19" column="5" lean-forward="true" selection-start-line="19" selection-start-column="5" selection-end-line="19" selection-end-column="5" />
<folding />
</state>
</provider>
@ -156,10 +173,21 @@
<find>close(</find>
<find>status</find>
<find>createdAt</find>
<find>preInj</find>
<find>p</find>
<find>printDebug</find>
<find>d</find>
<find>debug</find>
<find>_printDebug</find>
<find>use(</find>
</findStrings>
<replaceStrings>
<replace>_isClosed</replace>
<replace>// _printDebug</replace>
</replaceStrings>
<dirStrings>
<dir>C:\Users\thosa\Source\Angel\framework\lib</dir>
</dirStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -168,23 +196,24 @@
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/lib/src/http/routable.dart" />
<option value="$PROJECT_DIR$/test/common.dart" />
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/fatal_error.dart" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http_exception.dart" />
<option value="$PROJECT_DIR$/lib/src/http/memory_service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/lib/src/http/hooked_service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/server.dart" />
<option value="$PROJECT_DIR$/lib/src/http/map_service.dart" />
<option value="$PROJECT_DIR$/lib/src/http/response_context.dart" />
<option value="$PROJECT_DIR$/lib/hooks.dart" />
<option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/test/util_test.dart" />
<option value="$PROJECT_DIR$/test/services_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/service.dart" />
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/routable.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/lib/src/http/server.dart" />
<option value="$PROJECT_DIR$/README.md" />
</list>
</option>
@ -220,7 +249,6 @@
</navigator>
<panes>
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
@ -303,6 +331,7 @@
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -397,13 +426,19 @@
<recursive>false</recursive>
<method />
</configuration>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="Dart Test.Controller Tests" />
<item index="1" class="java.lang.String" itemvalue="Dart Test.DI Tests" />
<item index="2" class="java.lang.String" itemvalue="Dart Test.Hooked Tests" />
<item index="3" class="java.lang.String" itemvalue="Dart Test.Routing Tests" />
<item index="4" class="java.lang.String" itemvalue="Dart Test.All Tests" />
<item index="5" class="java.lang.String" itemvalue="Dart Command Line App.All Tests (for coverage)" />
<configuration default="false" name="tests in precontained_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/test/precontained_test.dart" />
<option name="testName" value="precontained_test.dart" />
<method />
</configuration>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="Dart Test.tests in precontained_test.dart" />
<item index="1" class="java.lang.String" itemvalue="Dart Test.Controller Tests" />
<item index="2" class="java.lang.String" itemvalue="Dart Test.DI Tests" />
<item index="3" class="java.lang.String" itemvalue="Dart Test.Hooked Tests" />
<item index="4" class="java.lang.String" itemvalue="Dart Test.Routing Tests" />
<item index="5" class="java.lang.String" itemvalue="Dart Test.All Tests" />
<item index="6" class="java.lang.String" itemvalue="Dart Command Line App.All Tests (for coverage)" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false">
@ -429,7 +464,10 @@
<workItem from="1493090308747" duration="91000" />
<workItem from="1493247154761" duration="249000" />
<workItem from="1493439393087" duration="103000" />
<workItem from="1495887910182" duration="863000" />
<workItem from="1495887910182" duration="895000" />
<workItem from="1495996220490" duration="67000" />
<workItem from="1496058266595" duration="1116000" />
<workItem from="1496752349569" duration="598000" />
</task>
<task id="LOCAL-00001" summary="Re-designed exception">
<created>1481237183504</created>
@ -508,43 +546,50 @@
<option name="project" value="LOCAL" />
<updated>1493247351000</updated>
</task>
<option name="localTasksCounter" value="12" />
<task id="LOCAL-00012" summary="Coverage start...">
<created>1495888785100</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1495888785100</updated>
</task>
<option name="localTasksCounter" value="13" />
<servers />
</component>
<component name="TestHistory">
<history-entry file="All_Tests - 2017.04.15 at 13h 41m 54s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 07h 54m 45s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2017.04.24 at 22h 30m 02s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 07h 56m 41s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2017.04.24 at 22h 32m 10s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 07h 58m 57s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2017.05.27 at 08h 29m 17s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 07h 59m 07s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Hooked_Tests - 2016.12.10 at 09h 01m 45s.xml">
<configuration name="Hooked Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 08h 00m 14s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Hooked_Tests - 2016.12.10 at 09h 02m 37s.xml">
<configuration name="Hooked Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 08h 00m 43s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Hooked_Tests - 2016.12.10 at 09h 03m 36s.xml">
<configuration name="Hooked Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 08h 01m 42s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Hooked_Tests - 2016.12.10 at 09h 04m 06s.xml">
<configuration name="Hooked Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 08h 02m 39s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Hooked_Tests - 2016.12.10 at 09h 04m 28s.xml">
<configuration name="Hooked Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.05.29 at 08h 02m 54s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Routing_Tests - 2016.12.30 at 21h 11m 10s.xml">
<configuration name="Routing Tests" configurationId="DartTestRunConfigurationType" />
<history-entry file="tests_in_precontained_test_dart - 2017.06.06 at 08h 33m 54s.xml">
<configuration name="tests in precontained_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="7881000" />
<option name="totallyTimeSpent" value="9694000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -559,25 +604,25 @@
<frame x="-9" y="-9" width="1938" height="1048" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30301428" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22633527" sideWeight="0.5" order="0" 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.3292683" 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.32616082" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" 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.3295583" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32802936" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3272933" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" 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="-1" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3272933" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" 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.3250283" sideWeight="0.5" order="7" 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.4" 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="2" side_tool="true" 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.4" sideWeight="0.5" order="3" side_tool="false" 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" />
<window_info id="Tool Output" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" 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="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="ANTLR Preview" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
@ -600,23 +645,14 @@
<MESSAGE value="+1" />
<MESSAGE value="+2" />
<MESSAGE value="+3" />
<option name="LAST_COMMIT_MESSAGE" value="+3" />
<MESSAGE value="Coverage start..." />
<option name="LAST_COMMIT_MESSAGE" value="Coverage start..." />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="75">
<caret line="5" column="39" lean-forward="true" selection-start-line="5" selection-start-column="39" selection-end-line="5" selection-end-column="39" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2175">
@ -629,9 +665,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3555">
<caret line="237" column="49" lean-forward="true" selection-start-line="237" selection-start-column="49" selection-end-line="237" selection-end-column="49" />
<folding>
<element signature="e#38#58#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -697,9 +730,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3540">
<caret line="236" column="27" lean-forward="false" selection-start-line="236" selection-start-column="27" selection-end-line="236" selection-end-column="27" />
<folding>
<element signature="e#38#58#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -824,66 +854,25 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1215">
<caret line="88" column="30" lean-forward="false" selection-start-line="88" selection-start-column="30" selection-end-line="88" selection-end-column="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http_exception.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1113">
<caret line="53" column="0" lean-forward="false" selection-start-line="53" selection-start-column="0" selection-end-line="53" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/map_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-585">
<caret line="20" column="3" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446">
<state relative-caret-position="1239">
<caret line="67" column="32" lean-forward="false" selection-start-line="67" selection-start-column="32" selection-end-line="67" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="547">
<caret line="267" column="95" lean-forward="false" selection-start-line="267" selection-start-column="95" selection-end-line="267" selection-end-column="95" />
<folding>
<marker date="1495888340898" expanded="true" signature="318:418" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/all.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="19" column="27" lean-forward="false" selection-start-line="19" selection-start-column="27" selection-end-line="19" selection-end-column="27" />
<folding>
<element signature="e#0#44#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/general_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="158">
<caret line="14" column="46" lean-forward="true" selection-start-line="14" selection-start-column="46" selection-end-line="14" selection-end-column="46" />
<folding>
<element signature="e#0#22#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -891,19 +880,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-522">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#22#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="522">
<caret line="201" column="0" lean-forward="false" selection-start-line="201" selection-start-column="0" selection-end-line="201" selection-end-column="0" />
<folding>
<element signature="e#38#58#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -911,7 +887,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1467">
<caret line="90" column="25" lean-forward="false" selection-start-line="90" selection-start-column="25" selection-end-line="90" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
@ -919,9 +894,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="231">
<caret line="11" column="12" lean-forward="false" selection-start-line="11" selection-start-column="12" selection-end-line="11" selection-end-column="12" />
<folding>
<element signature="e#0#54#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
@ -929,7 +901,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="249">
<caret line="30" column="32" lean-forward="false" selection-start-line="30" selection-start-column="32" selection-end-line="30" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
@ -937,31 +908,21 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="720">
<state relative-caret-position="1344">
<caret line="70" column="2" lean-forward="false" selection-start-line="70" selection-start-column="2" selection-end-line="70" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="188">
<caret line="105" column="14" lean-forward="false" selection-start-line="105" selection-start-column="14" selection-end-line="105" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_base.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-192">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@ -969,30 +930,90 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="249">
<caret line="710" column="21" lean-forward="true" selection-start-line="710" selection-start-column="21" selection-end-line="710" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="651">
<caret line="39" column="86" lean-forward="false" selection-start-line="39" selection-start-column="86" selection-end-line="39" selection-end-column="86" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/map_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="378">
<caret line="20" column="3" lean-forward="false" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/all.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="17" column="43" lean-forward="false" selection-start-line="17" selection-start-column="43" selection-end-line="17" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/hooks.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5544">
<caret line="267" column="95" lean-forward="false" selection-start-line="267" selection-start-column="95" selection-end-line="267" selection-end-column="95" />
<folding>
<marker date="1495888340898" expanded="true" signature="318:418" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/precontained_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="19" column="33" lean-forward="false" selection-start-line="19" selection-start-column="33" selection-end-line="19" selection-end-column="33" />
<folding>
<element signature="e#0#22#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="17" column="22" lean-forward="false" selection-start-line="17" selection-start-column="22" selection-end-line="17" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="305">
<caret line="125" column="45" lean-forward="false" selection-start-line="125" selection-start-column="45" selection-end-line="125" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="485">
<caret line="164" column="37" lean-forward="false" selection-start-line="164" selection-start-column="37" selection-end-line="164" selection-end-column="37" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="438">
<caret line="215" column="0" lean-forward="true" selection-start-line="215" selection-start-column="0" selection-end-line="215" selection-end-column="0" />
<state relative-caret-position="284">
<caret line="19" column="5" lean-forward="true" selection-start-line="19" selection-start-column="5" selection-end-line="19" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/service.dart">
<entry file="file://$PROJECT_DIR$/lib/src/http/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="237">
<caret line="84" column="13" lean-forward="true" selection-start-line="84" selection-start-column="13" selection-end-line="84" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="21">
<caret line="1" column="16" lean-forward="false" selection-start-line="1" selection-start-column="16" selection-end-line="1" selection-end-column="16" />
<state relative-caret-position="313">
<caret line="286" column="5" lean-forward="true" selection-start-line="286" selection-start-column="5" selection-end-line="286" selection-end-column="5" />
<folding />
</state>
</provider>
@ -1000,10 +1021,10 @@
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="30">
<caret line="2" column="56" lean-forward="false" selection-start-line="2" selection-start-column="56" selection-end-line="2" selection-end-column="56" />
<first_editor relative-caret-position="42">
<caret line="2" column="12" lean-forward="false" selection-start-line="2" selection-start-column="12" selection-end-line="2" selection-end-column="12" />
<folding>
<marker date="1495888771338" expanded="true" signature="432:620" ph="{...}" />
<marker date="1496752945216" expanded="true" signature="428:616" ph="{...}" />
</folding>
</first_editor>
<second_editor />

View file

@ -1,6 +1,6 @@
# angel_framework
[![pub 1.0.2+5](https://img.shields.io/badge/pub-1.0.2+5-brightgreen.svg)](https://pub.dartlang.org/packages/angel_framework)
[![pub 1.0.3](https://img.shields.io/badge/pub-1.0.3-brightgreen.svg)](https://pub.dartlang.org/packages/angel_framework)
[![build status](https://travis-ci.org/angel-dart/framework.svg)](https://travis-ci.org/angel-dart/framework)
A high-powered HTTP server with support for dependency injection, sophisticated routing and more.

View file

@ -143,13 +143,14 @@ RequestHandler createDynamicHandler(handler,
injection.optional.addAll(optional ?? []);
return handleContained(handler, injection);
}
/// Handles a request with a DI-enabled handler.
RequestHandler handleContained(handler, InjectionRequest injection) {
return (RequestContext req, ResponseContext res) async {
List args = [];
void inject(requirement) {
var propFromApp;
if (requirement == RequestContext) {
args.add(req);
} else if (requirement == ResponseContext) {
@ -161,6 +162,8 @@ RequestHandler handleContained(handler, InjectionRequest injection) {
args.add(req.injections[requirement]);
else if (req.properties.containsKey(requirement))
args.add(req.properties[requirement]);
else if ((propFromApp = req.app.findProperty(requirement)) != null)
args.add(propFromApp);
else if (injection.optional.contains(requirement))
args.add(null);
else {
@ -174,7 +177,10 @@ RequestHandler handleContained(handler, InjectionRequest injection) {
String key = requirement.first;
Type type = requirement.last;
if (req.params.containsKey(key) || req.injections.containsKey(key)) {
if (req.params.containsKey(key) ||
req.injections.containsKey(key) ||
req.properties.containsKey(key) ||
req.app.properties.containsKey(key)) {
inject(key);
} else
inject(type);

View file

@ -124,8 +124,15 @@ class Routable extends Router {
Map copiedMiddleware = new Map.from(router.requestMiddleware);
for (String middlewareName in copiedMiddleware.keys) {
requestMiddleware["$middlewarePrefix$middlewareName"] =
copiedMiddleware[middlewareName];
requestMiddleware.putIfAbsent("$middlewarePrefix$middlewareName",
() => copiedMiddleware[middlewareName]);
}
// Also copy properties...
Map copiedProperties = new Map.from(router.properties);
for (String propertyName in copiedProperties.keys) {
properties.putIfAbsent("$middlewarePrefix$propertyName",
() => copiedMiddleware[propertyName]);
}
// _router.dumpTree(header: 'Mounting on "$path":');

View file

@ -49,6 +49,11 @@ class Angel extends AngelBase {
final Map<dynamic, InjectionRequest> _preContained = {};
ResponseSerializer _serializer;
/// A [Map] of dependency data obtained via reflection.
///
/// You may modify this [Map] yourself if you intend to avoid reflection entirely.
Map<dynamic, InjectionRequest> get preContained => _preContained;
/// Determines whether to allow HTTP request method overrides.
bool allowMethodOverrides = true;
@ -135,10 +140,6 @@ class Angel extends AngelBase {
_fatalErrorStream.add(new AngelFatalError(error: e, stack: st));
}
void _printDebug(x) {
if (debug) print(x);
}
/// Starts the server.
///
/// Returns false on failure; otherwise, returns the HttpServer.
@ -285,8 +286,9 @@ class Angel extends AngelBase {
return result;
}
if (requestMiddleware.containsKey(handler)) {
return await getHandlerResult(requestMiddleware[handler], req, res);
var middleware = (req.app ?? this).findMiddleware(handler);
if (middleware != null) {
return await getHandlerResult(middleware, req, res);
}
return handler;
@ -321,6 +323,18 @@ class Angel extends AngelBase {
new ResponseContext(response, this)
..serializer = (_serializer ?? god.serialize);
/// Attempts to find a middleware by the given name within this application.
findMiddleware(key) {
if (requestMiddleware.containsKey(key)) return requestMiddleware[key];
return parent != null ? parent.findMiddleware(key) : null;
}
/// Attempts to find a property by the given name within this application.
findProperty(key) {
if (properties.containsKey(key)) return properties[key];
return parent != null ? parent.findProperty(key) : null;
}
/// Handles a single request.
Future handleRequest(HttpRequest request) async {
try {
@ -347,24 +361,24 @@ class Angel extends AngelBase {
var pipeline = []..addAll(before)..addAll(m.handlers)..addAll(after);
_printDebug('Handler sequence on $requestedUrl: $pipeline');
// _printDebug('Handler sequence on $requestedUrl: $pipeline');
for (var handler in pipeline) {
try {
_printDebug('Executing handler: $handler');
// _printDebug('Executing handler: $handler');
var result = await executeHandler(handler, req, res);
_printDebug('Result: $result');
// _printDebug('Result: $result');
if (!result) {
_printDebug('Last executed handler: $handler');
// _printDebug('Last executed handler: $handler');
break;
} else {
_printDebug(
'Handler completed successfully, did not terminate response: $handler');
// _printDebug(
// 'Handler completed successfully, did not terminate response: $handler');
}
} catch (e, st) {
_printDebug('Caught error in handler $handler: $e');
_printDebug(st);
// _printDebug('Caught error in handler $handler: $e');
// _printDebug(st);
if (e is AngelHttpException) {
// Special handling for AngelHttpExceptions :)
@ -413,8 +427,10 @@ class Angel extends AngelBase {
/// * Preprocesses all dependency injection, and eliminates the burden of reflecting handlers
/// at run-time.
/// * [flatten]s the route tree into a linear one.
void optimizeForProduction() {
if (isProduction == true) {
///
/// You may [force] the optimization to run, if you are not running in production.
void optimizeForProduction({bool force: false}) {
if (isProduction == true || force == true) {
_add(v) {
if (v is Function && !_preContained.containsKey(v)) {
_preContained[v] = preInject(v);
@ -428,10 +444,10 @@ class Angel extends AngelBase {
router.requestMiddleware.forEach((k, v) => _add(v));
router.middleware.forEach(_add);
router.routes
.where((r) => r is SymlinkRoute)
.map((SymlinkRoute r) => r.router)
.forEach(_walk);
router.routes.forEach((r) {
r.handlers.forEach(_add);
if (r is SymlinkRoute) _walk(r.router);
});
}
if (_flattened == null) _flattened = flatten(this);

View file

@ -37,6 +37,13 @@ class Providers {
///
/// Heavily inspired by FeathersJS. <3
class Service extends Routable {
/// A [List] of keys that services should ignore, should they see them in the query.
static const List<String> SPECIAL_QUERY_KEYS = const [
r'$limit',
r'$sort',
'page'
];
/// The [Angel] app powering this service.
AngelBase app;
@ -99,9 +106,8 @@ class Service extends Routable {
req.serviceParams
]));
},
middleware: []
..addAll(handlers)
..addAll((indexMiddleware == null) ? [] : indexMiddleware.handlers));
middleware: []..addAll(handlers)..addAll(
(indexMiddleware == null) ? [] : indexMiddleware.handlers));
Middleware createMiddleware = getAnnotation(this.create, Middleware);
post('/', (req, ResponseContext res) async {
@ -115,30 +121,29 @@ class Service extends Routable {
res.statusCode = 201;
return r;
},
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(createMiddleware == null) ? [] : createMiddleware.handlers));
Middleware readMiddleware = getAnnotation(this.read, Middleware);
get(
'/:id',
(req, res) async => await this.read(
(req, res) async =>
await this.read(
toId(req.params['id']),
mergeMap([
{'query': req.query},
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll((readMiddleware == null) ? [] : readMiddleware.handlers));
middleware: []..addAll(handlers)..addAll(
(readMiddleware == null) ? [] : readMiddleware.handlers));
Middleware modifyMiddleware = getAnnotation(this.modify, Middleware);
patch(
'/:id',
(req, res) async => await this.modify(
(req, res) async =>
await this.modify(
toId(req.params['id']),
await req.lazyBody(),
mergeMap([
@ -146,15 +151,14 @@ class Service extends Routable {
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(modifyMiddleware == null) ? [] : modifyMiddleware.handlers));
Middleware updateMiddleware = getAnnotation(this.update, Middleware);
post(
'/:id',
(req, res) async => await this.update(
(req, res) async =>
await this.update(
toId(req.params['id']),
await req.lazyBody(),
mergeMap([
@ -162,13 +166,12 @@ class Service extends Routable {
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(updateMiddleware == null) ? [] : updateMiddleware.handlers));
put(
'/:id',
(req, res) async => await this.update(
(req, res) async =>
await this.update(
toId(req.params['id']),
await req.lazyBody(),
mergeMap([
@ -176,37 +179,33 @@ class Service extends Routable {
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(updateMiddleware == null) ? [] : updateMiddleware.handlers));
Middleware removeMiddleware = getAnnotation(this.remove, Middleware);
delete(
'/',
(req, res) async => await this.remove(
(req, res) async =>
await this.remove(
null,
mergeMap([
{'query': req.query},
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(removeMiddleware == null) ? [] : removeMiddleware.handlers));
delete(
'/:id',
(req, res) async => await this.remove(
(req, res) async =>
await this.remove(
toId(req.params['id']),
mergeMap([
{'query': req.query},
restProvider,
req.serviceParams
])),
middleware: []
..addAll(handlers)
..addAll(
middleware: []..addAll(handlers)..addAll(
(removeMiddleware == null) ? [] : removeMiddleware.handlers));
// REST compliance

View file

@ -15,5 +15,6 @@ dependencies:
random_string: ^0.0.1
mime: ^0.9.3
dev_dependencies:
mock_request: ^1.0.0
http: ^0.11.3
test: ^0.12.13

View file

@ -2,6 +2,7 @@ import 'controller_test.dart' as controller;
import 'di_test.dart' as di;
import 'general_test.dart' as general;
import 'hooked_test.dart' as hooked;
import 'precontained_test.dart' as precontained;
import 'routing_test.dart' as routing;
import 'serialize_test.dart' as serialize;
import 'services_test.dart' as services;
@ -14,6 +15,7 @@ main() {
group('di', di.main);
group('general', general.main);
group('hooked', hooked.main);
group('precontained', precontained.main);
group('routing', routing.main);
group('serialize', serialize.main);
group('services', services.main);

View file

@ -0,0 +1,24 @@
import 'dart:convert';
import 'package:angel_framework/angel_framework.dart';
import 'package:mock_request/mock_request.dart';
import 'package:test/test.dart';
main() {
test('preinjects functions', () async {
var app = new Angel()
..properties['foo'] = 'bar'
..get('/foo', echoAppFoo);
app.optimizeForProduction(force: true);
print(app.preContained);
expect(app.preContained, contains(echoAppFoo));
var rq = new MockHttpRequest('GET', new Uri(path: '/foo'));
rq.close();
await app.handleRequest(rq);
var rs = rq.response;
var body = await rs.transform(UTF8.decoder).join();
expect(body, JSON.encode('bar'));
});
}
echoAppFoo(String foo) => foo;